New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chaining element selector will not match deep descendants #1465
Comments
It looks to me like this issue has the same root cause: |
@scags9876 looking at the logs the xpath looks about right:
This should find the label inside the topdiv element: <div id="topdib">
<label>Took</label>
</div> |
@christian-bromann thanks for the reply. The problem is when the element being queried is a child of a child. Such as seen here: http://jsbin.com/topaku/edit?html,output Or directly here:
First level descendants work fine, it is when the element is a deeper descendant that the problem manifests. |
Use xpath select `.//` instead of `./` to match elements anywhere in the descendant tree, instead of just in the first level of children. Issue webdriverio#1465
Merged PR. Thanks again! |
The problem
Chaining a selector will fail if the element is not an immediate descendant of the base element. It should search the entire descendant tree of the base element.
Environment
Details
With the fix to #1354 a change was made to the findStrategy of chained elements to use the 'relative' flag. While this fixed the issue, it uncovered the fact for us that the relative selection only selects immediate children, and not deep descendants.
There should be an easy for this: changing lib/helpers/findElementStrategy.js:8 to:
That is, changing the relative xpathPrefix to
.//
from./
Link to Selenium/WebdriverIO logs
https://gist.github.com/scags9876/ba6e4eb23da25d58cfa17cd3d9e02830
Code To Reproduce Issue [ Good To Have ]
Does not work
Looking for a label which is inside a containing div in the parent div. This results in an error:
The text was updated successfully, but these errors were encountered: