I'm using WebdriverIO
to drive my Selenium server, but I was curious if there is a guarantee in the Selenium spec, or in the CSS spec that guarantees elements are returned in the order they are found appearing on the page.
For instance:
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
If I were to do driver.getText('li');
, am I guaranteed that it will return:
['One', 'Two', 'Three']
Or are there cases where the behavior will be undefined? Maybe also, what sort of behavior should I expect? I suppose it's probably a depth first search?