What is the current behavior of scaffold?
Inside of getRawWebElement() any time an element is used, a call to waitUntilDisplayed() is called which adds very nice default waiting capabilities to scaffold and handles a good amount of waiting issues we'd see.
However this does mean that an element that resolves to element.isDisplayed() == false will throw a TimeoutException and will not be usable.
What should we change?
We should create an annotation of @HiddenElement that can be attached to any BaseWebElement.class child to turn off the waitUntilDisplayed() call, to restore the ability to lookup hidden elements in scaffold.
Why?
There will be cases where an element is 'hidden' by selenium's standards, but the element is visible to the end-user, that we may still want to interact with or read properties from. In it's current state, we essentially cannot access hidden elements at all since they will throw an exception.
What are the risks?
Consumers of scaffold might use this annotation as a catch-all, but with documentation around the use case of this annotation as well as led discussions on what this is used for, this shouldn't be a problem.
Also, the default waiting mechanism is removed from the hidden element, so if any extra waiting is necessary it would be on the end-user to make any extra wait calls on their own.
Are there any alternatives?
I don't believe so, you may be able to use a parent element and still interact with the child element, but you also may not be. For example, if there's a div wrapped around an <input>, and the input is hidden but the div is not, you might be able to still send keys to and clear the input via the div. But you also may not. Also any parent.findElement("childLocator") call will suffer from the same issue of the child not being visible, and will throw a TimeoutException, so you won't be able to access the child anyways.
A/C
Add a new annotation called HiddenElement that is to be applied at the FIELD level, intended to be attached to calls such as:
@HiddenElement
DivWebElement hiddenThing = new DivWebElement("locator");
Update unit tests accordingly to take the new annotation into account, as well as add unit tests specifically around making sure that waitUntilDisplayed() is not called when the @HiddenElement annotation is attached
Summary
getRawWebElement()
any time an element is used, a call towaitUntilDisplayed()
is called which adds very nice default waiting capabilities to scaffold and handles a good amount of waiting issues we'd see.However this does mean that an element that resolves to
element.isDisplayed() == false
will throw a TimeoutException and will not be usable.What should we change? We should create an annotation of
@HiddenElement
that can be attached to any BaseWebElement.class child to turn off thewaitUntilDisplayed()
call, to restore the ability to lookup hidden elements in scaffold.Why? There will be cases where an element is 'hidden' by selenium's standards, but the element is visible to the end-user, that we may still want to interact with or read properties from. In it's current state, we essentially cannot access hidden elements at all since they will throw an exception.
What are the risks? Consumers of scaffold might use this annotation as a catch-all, but with documentation around the use case of this annotation as well as led discussions on what this is used for, this shouldn't be a problem.
Also, the default waiting mechanism is removed from the hidden element, so if any extra waiting is necessary it would be on the end-user to make any extra wait calls on their own.
<input>
, and the input is hidden but the div is not, you might be able to still send keys to and clear the input via the div. But you also may not. Also anyparent.findElement("childLocator")
call will suffer from the same issue of the child not being visible, and will throw a TimeoutException, so you won't be able to access the child anyways.A/C
HiddenElement
that is to be applied at theFIELD
level, intended to be attached to calls such as:waitUntilDisplayed()
is not called when the@HiddenElement
annotation is attached