Cannot get element via name
See original GitHub issueI have an array of input elements, for inputting an address.
I am trying to get the first input, to type in an address.
cy.get('[name=street[0]]').type('123 Townsville'); // doesn't work
cy.get('[name=street[]]').type('123 Townsville'); // doesn't work
cy.get('[name=street]').type('123 Townsville'); // doesn't work
Before anyone mentions using a data attribute, or adding a class etc - I am dealing with the markup with out-of-the-box Magento and I am not interested in changing it just to pass the tests. It should work using the test I have written.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Javascript can't find element by id? [duplicate] - Stack Overflow
The problem is that you are trying to access the element before it exists. You need to wait for the page to be...
Read more >Document.getElementById() - Web APIs | MDN
The Document method getElementById() returns an Element object representing the element whose id property matches the specified string.
Read more >HTML DOM Document getElementsByName() - W3Schools
Definition and Usage. The getElementsByName() method returns a collection of elements with a specified name. The getElementsByName() method returns a live ...
Read more >Searching: getElement*, querySelector*
If an element has the id attribute, we can get the element using the method document.getElementById(id) , no matter where it is.
Read more >Issue with jQuery (Can't find element in DOM by ID) - Laracasts
data('away-name'); $(this).find("#awayTeamLabel").text(awayTeamName); });. It works in one file of my code but not in another ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
cy.get('[name="street[0]"]')
works for me against the following html:<input type="text" name="street[0]">
, can you verify that this is the html that is rendered to the page?Including the double-quotes was the key.