kgress / scaffold

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

Update AbstractClickable.click() to also wait until clickable #48

Open kgress opened 4 years ago

kgress commented 4 years ago

Summary

Currently, if explicit waits are enabled, scaffold will wait until an element is displayed prior to clicking the element. Unfortunately, there are instances where the element might be displayed but not clickable. Depending on the design of the site, this can be encountered mostly from slow loading modals; if the modal is partially displayed but not entirely displayed, web driver views this as being "displayed" but when it tries to click the element, it is intercepted by an element other than the modal.

We should update the click method to account for this variability. I anticipate this is a somewhat trivial addition as we can update AbstractClickable's click() method with a try catch around getWebElement().click(), as seen at this link. We can write this try catch as a while loop with a finite amount of retries catching InterceptedElementException. After so many tries, throw an error that the element just couldn't be clicked for whatever the bubbled up reason is.

Include a unit test with a negative test case expectation that includes the scenario of the element not being clickable.

A/C