Tag Archives: featured

Using Retries in tests can hide the bugs

We are quite familiar with the concept of randomly failing automated tests. Those are the tests that even though there is no change in the feature they are testing, they either fail randomly at the same step, or they fail at random steps. Handling the results of such tests can be tricky, and some teams choose to simply retry a test if it failed. But is that the best option? Here are my thoughts. Continue reading Using Retries in tests can hide the bugs

The weird true story of Selenium, the StaleElementReferenceException, the iframe, the List and the WebElement

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

Generating useful date values for testing purposes

If in your tests you need to generate date values representing, let’s say, today’s date, or yesterday’s, or one year from today, or the last day of the current month, this post will help you do just that. Using Java’s LocalDate, you will be able to generate the date (meaning year, month, day) your tests require easily. Continue reading Generating useful date values for testing purposes

Working with user prompts in Selenium

In your tests you might encounter specialized popups, which are generated via Javascript, and which are called ‘user prompts’. These are very basic in functionality, and they come in three variants: an ‘alert’ which only displays an informational message and an ‘OK’ button; a ‘confirm’ which displays an informational message, together with an ‘OK’ and ‘Cancel’ button; a ‘prompt’ which displays an informational message, possibly an input field for typing into, and an ‘OK’ and ‘Cancel’ button. Continue reading Working with user prompts in Selenium

Iframes, switchTo() and default content with Selenium

So, now that you are an expert in writing CSS selectors to identify your WebElements (possible because of my older webinar on this topic), you want to write some new tests. You are inspecting the page you will test, identifying what WebElements you will need, and start writing the selectors. Once you have them, and the test contains all the necessary interactions with those WebElements, you run the test, confident it will pass. But instead, surprise. You get a NoSuchElementException. You double, triple, quadruple check the page, and by the looks of it, the selector is correctly written. And that is true. However, when you inspect the page further, you notice that your element is actually contained within an <iframe> tag (<iframe>…</iframe>). Continue reading Iframes, switchTo() and default content with Selenium