Tag Archives: iframe

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

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