I am very confused with what the documentation for ByChained class mentions. It says:
Mechanism used to locate elements within a docu
Your request would be satisfied by something that could be called ByAny
which would return elements that match any of the passed By
arguments. There's no such class AFAIK.
However, ByChained works differently. It finds the elements that are matched by the first argument, then searches their descendants using the second argument etc. So, if you had HTMl like this:
and you wanted to find the class=personName
element under id=details
, you could either use a CSS selector, an XPath expression, or the
new ByChained(By.id("details"), By.className("personName"))
Note that there also is a ByAll class that searches for elements matched by all of the By
arguments passed.