How do one properly iterate over elements?
See original GitHub issueOn webdriver homepage there is an example:
var results = $$('.commands.property a').filter(function (link) {
return link.isVisible();
});
Spectron is promised-based, therefore I adopt it to something like this:
var results = await app.client.$$('.commands.property a')
var filtered = results.filter(function (link) {
return link.isVisible();
});
But it throws TypeError: link.isVisible is not a function
. Same error occurs on this:
var results = await app.client.$$('..commands.property a')
var isVisible = results[0].isVisible()
So what is a proper way to iterate over array of dom elelements returned from $$
?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Iteration over lists | AP CSP (article) - Khan Academy
To do that, we can use a loop to iterate over each element, repeating the same code for each element.
Read more >Iterate Over Selected Elements - JavaScript Tutorial
To iterate over the selected elements, you can use forEach() method (supported by most modern web browsers, not IE) or just use the...
Read more >How to correctly iterate through getElementsByClassName
According to MDN, the way to retrieve an item from a NodeList is: nodeItem = nodeList.item(index). Thus: var slides = document.
Read more >JS For Loop Tutorial – How to Iterate Over an Array in JavaScript
Here's how we will tackle iterating over arrays in JavaScript: ... It moves through the array and prints one element at a time....
Read more >HTMLCollection for Loop - GeeksforGeeks
The elements can be iterated through by using a normal for loop. The number of elements in the HTMLCollection can be found out...
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
Yep, it works.
@DHedgecock I gues we can use
:nth-child(n)
for this:Haven’t tested yet.