kgress / scaffold

A Java based Selenium WebDriver abstraction
MIT License
4 stars 7 forks source link

BaseWebElement#findElement() and findElements() are not checking both child and parent for XPATH #132

Closed kgress closed 2 years ago

kgress commented 2 years ago

Bug

The BaseWebElement#findElement() and BaseWebElement#findElements() methods are not checking to make sure the parent and child are not of the type XPATH. This was changed in the recent feature update for Components, not considering a use case where users might still be invoking either method during class variable instantiation or using custom Scaffold strong typed extended elements.

Expected

As a bandaid, we should update the methods to check both the parent and child during the getParentBy() check. This should allow the correct logic pathing as to how we were constructing elements before, where the returned Scaffold strong typed element is using the WebElement.class constructor.

The reason this is meant to be a bandaid is for "keep the lights on" for projects that might be using this particular type of code implementation. I highly encourage users to move away from invoking findElement() and findElements() in a class variable.