I am very confused with what the documentation for ByChained class mentions. It says:
Mechanism used to locate elements within a docu
What this class does is allow you to locate an element using its heirarchy in the dom.
lets say for some reason you have the following html:
and you want to get the element that is between the div rather than the one on its own. You can use the ByChained by to specify that you want that element by doing the following:
new ByChained(By.id("details"),By.id("firstName"));
What happens is that it finds the first element then searches underneath that in the dom heirarchy for the selector that comes next in the list. Basically this By is just a nice clean way of no longer having to do the following:
details = driver.findElement(By.id("details"));
input = details.findElement(By.id("firstName"));