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… Read More
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… Read More
Working with windows/tabs in Selenium
When testing requires you to work with multiple open windows or tabs, Selenium is here to help. A new window or tab usually opens when a user clicks on a button or link which triggers the new page that loads to be open in a new window or tab. Whether it is a window or… Read More
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… Read More
Browser unaware Selenium tests. STEP 3: Starting a browser based on a system property
By now, following the previous two posts in this series, you have setup the methods that initialize a Chrome and a Firefox browser. In this post, you will see how to use System properties for easily switching the browser in tests.
Browser unaware Selenium tests. STEP 2: Creating the browser initialization methods for Chrome and Firefox
In this second post of the ‘browser unaware Selenium tests’ series, i will show what the methods that start Chrome and Firefox look like, based on the selected OSs from the previous post.
Browser unaware Selenium tests. STEP 1: Identify OSs on which to run tests + choose browsers to support
In this blog post series, i want to show how i normally set up my browsers and my Selenium code, in order to enable writing ‘cross-OS’, ‘cross-browser’, ‘browser-unaware’ tests. What this means: my tests can run on any OS i set up seamlessly; each test can be run on multiple browsers seamlessly; the tests do… Read More
thewaiter: wait for WebElement attribute. To equal, contain a String, with variations.
An attribute of an HTML tag (or WebElement as you might know it from Selenium) stores valuable information about the state of that element. If we are thinking of checkboxes, a “checked” attribute will signal whether the checkbox is selected or not. For a link, the “href” attribute will tell us what location on the… Read More
How WebDriverWait works differently for WebElements defined by driver.findElement versus PageFactory initialization
When it comes to using WebDriverWait to wait for WebElement properties,like text or attributes, when sending WebElements as properties generated via PageFactory, that will work properly. However when using ‘driver.findElement()’ to identify the WebElements required as parameters in the WebDriverWaits, that will fail. Here is the reason why.
Use waits as assertions for your Selenium tests
Selenium tests tend to make a lot of use of assertions, to check that some actions have been performed on the front-end or that some WebElement properties are the expected ones. And by assertions, I mean, mostly: assertEquals or assertTrue, as these are the most commonly used ones. Assertions fail too often due to the… Read More