I was using selenium for a while, but I have never had a great basic for JAVA programming or selenium webdriver(I’m a software tester who started to write automated tests by my own without any help or course). I’m able to write webdriver scripts for our web-application(based on JAVA and JSF), and these works fine in the most cases, but sometimes tests could fails randomly, however the application is totally OK. When I tried to debugging, I always bumped into the timing problem. I use both explicit and implicit waits, but these are not enough for me. Since then I started to use a custom wait function, that I found on the internet(it waits for AJAX request completes ). It helped a lot because random fails are reduced to the minimum, but there’re still a few.
Sorry for my English, I hope you guys can understand what I mean.
There’s a simple example:
I try to check a text on the page to be present:
assertTrue(driver.findElement(By.xpath(“//[@id=’resultsForm’]/div/div”)).getText().contains(“Table header name”));
The test fails 2-3 times of 10, however the text is on the page every time.