Hi, We were facing some difficulties while executing UI integration test for ES. The current WebDriver class findElement(By by) was tending to fail giving element not found errors due to the high execution speed of the driver. For example it wasn't waiting until caramal page renders completes/ ajax call returns completes/ comment boxes appears and for some other cases as well. This was blocking record and play back capability of selenium and auto generating java test cases using selenium discussed in the mail thread[01], since they do not record waits/pause.
Therefore I have written a custom *WebDriver* class implementing *org.openqa.selenium.WebDriver* interface. It wraps the the current *WebDriver* return by *BrowserManager.getWebDriver().* I have overridden findElement(By by) method to wait for maximum of a given time (in our case 30sec) until the element is present in the page. At any moment the element is present, it will continue the execution. If it reach the waiting time without finding the element, it will timeout as in default findElement() method. Further I have introduced a new method *findElementPoll(By by, int pollCount) *which will repeatedly refresh/reload the page for maximum given number of *pollCount *times, untill a element is present. This method is useful for scenarios such as ES store/publisher has to wait until indexing complete.(ex: after adding a asset). This avoids using thread sleeps and relying on a timely wait until an element appears. All the other-methods of WebDriver class are returning original methods implemented in *BrowserManager.getWebDriver() *class for now. So far this approach has helped to avoid several thread sleeps and adding implicit/explicit waits manually in each and every test case. Hopefully we can introduce/override methods using this class to achieve common goals without changing each and every test case. I would appreciate any of your comments on this approach. [01] [Dev][ES] Selenium UI Integration Test Generation Thanks! - Ayesha *Ayesha Dissanayaka* Software Engineer, WSO2, Inc : http://wso2.com <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg> 20, Palmgrove Avenue, Colombo 3 E-Mail: [email protected] <[email protected]>
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
