I write a lot of automated tests. Most of the times, it all goes nice and smooth, like a good song. But once in a while i run into an automation situation that leaves me completely baffled. Debugging does not reveal how to fix it, and it is not very obvious to me what is going on. When do i realize what the issue was, i’m like ‘WOW i did not expect that’. These kind of stories are good to share, so that you know what to expect, should you encounter the same behavior. So, here is the peculiar, true story of Selenium, the StaleElementReferenceException, the iframe, the List and the WebElement. Continue reading The weird true story of Selenium, the StaleElementReferenceException, the iframe, the List and the WebElement
Tag Archives: exception
Better Test Code Principles #5: Mind your try/catches
Using try/catches to handle exceptions has become quite fashionable when writing tests with Java. However, this approach is also a frequent source of having false positives while running tests. Many times when writing the tests people forget to consider both sections of this code block: they forget to write the appropriate code in both sections – the code that deals with not encountering the exception (if the code in try executes) and the code that deals with encountering the exception (if the code in catch executes).
Continue reading Better Test Code Principles #5: Mind your try/catches
Selenium: How to correctly test whether an element is displayed (or not)
One of the most frequent kind of interactions with the web page when testing with Selenium is checking whether a particular element is present. More specifically, whether it is visible when looking at the page and does not have a “hidden” attribute. The isDisplayed() method is used for such checks, but in many cases it is not used properly. Some tests appear to be unreliable Continue reading Selenium: How to correctly test whether an element is displayed (or not)

