This question should maybe be asked in the wdio-screenshot repo, but anyway:
Disclaimer: This might be a bad idea, and I'd be really happy if you have any alternative solutions.
Let's say that I have a test where I want to:
Take a screenshot of every list item element with the selector ul>li on the following page: http://webdriver.io/, using the command browser.checkElement(elementSelector, [{options}]);.
Store all results in an array.
Assert every position in the array and the test only passes if all of them are true.
I'm trying to accomplish this by:
Get all "list items" using browser.elements('ul>li');
Using a loop, use browser.checkElement on each item in the array (returned from the previous step) and push the results into a "results array".
Using a loop, assert every position in the "results array".
I haven't found a way to do this, because browser.checkElement wants a selector to be passed. The selector is the same for every item in this case.
I might be missing something, or might've misunderstood something. This could be compared to clicking on a specific list item. Then I would just pass the element ID to browser.elementIdClick(). But.. in this case I can't pass an element ID to take a screenshot of a specific list item.
Nevermind.. =) I figured out that I could use :nth-of-child selector to accomplish what I wanted. Sorry if I've wasted anyone's time. I'm closing the "question".
Hi,
This question should maybe be asked in the wdio-screenshot repo, but anyway:
Disclaimer: This might be a bad idea, and I'd be really happy if you have any alternative solutions.
Let's say that I have a test where I want to:
browser.checkElement(elementSelector, [{options}]);
.I'm trying to accomplish this by:
browser.elements('ul>li');
browser.checkElement
on each item in the array (returned from the previous step) and push the results into a "results array".I haven't found a way to do this, because
browser.checkElement
wants a selector to be passed. The selector is the same for every item in this case.I might be missing something, or might've misunderstood something. This could be compared to clicking on a specific list item. Then I would just pass the element ID to
browser.elementIdClick()
. But.. in this case I can't pass an element ID to take a screenshot of a specific list item.