You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes you have a selector which results in multiple element matches but only want one of those elements - not the first which, by default, is the one always used. CSS does have nth pseudo-classes, but they're limited in what they can do. Xpath is better, supporting array access syntax (//<path>[0]) for targeting elements like this, but sometimes it doesn't always cut it, such as when using page objects with @-element references. In that case, the index would be fixed in the element definition when maybe you want to reuse that same reference to target multiple elements in that query ([0], [1], etc.).
browser.setValue('input','username');// how to target 2nd input element?page.click('@button');// or the 3rd button?
Being able to specifically target an element by an index within a resulting elements query would be nice.
The text was updated successfully, but these errors were encountered:
senocular
added a commit
to senocular/nightwatch
that referenced
this issue
Aug 2, 2016
Sometimes you have a selector which results in multiple element matches but only want one of those elements - not the first which, by default, is the one always used. CSS does have nth pseudo-classes, but they're limited in what they can do. Xpath is better, supporting array access syntax (
//<path>[0]
) for targeting elements like this, but sometimes it doesn't always cut it, such as when using page objects with @-element references. In that case, the index would be fixed in the element definition when maybe you want to reuse that same reference to target multiple elements in that query ([0], [1], etc.).Being able to specifically target an element by an index within a resulting elements query would be nice.
The text was updated successfully, but these errors were encountered: