Categories
Automated testing Python Selenium WebDriver

Browser closes automatically – how to fix it

Some time ago I came across a new, unusual feature of Selenium. After running the tests with Python, the browser closes on its own, even though the driver.quit() command is missing. This new feature is hard to notice when you’re maintaining an old project. When creating a new project, you may decide to leave the…

Categories
Automated testing Python Selenium WebDriver

StaleElementReferenceException – what is it and how to fix it

This is a common mistake that can be found in unexpected places. Usually, you meet it like this: you find all the elements you need and save them into variables. Then, you start using the items you have saved. Some of them you click, in some you enter text. And now, at some point, when…

Categories
Automated testing Python Selenium WebDriver

Now you don’t need to install chromedriver

In the past, before you could start using Selenium, you had to install drivers to interact with browsers. In order to be able to give commands to the browser, you had to install chromedriver or edgedriver or geckodriver, depending on which browser you intended to test on. Otherwise, you received an error with the text…

Categories
Automated testing Python Selenium WebDriver

How to use the By.CLASS_NAME selector and avoid common mistakes

Finding an element by its class name is an efficient yet convenient way to find many elements on a page. Despite its simplicity, many beginners make mistakes when using it. It may look like you’re doing everything right, but the NoSuchElementException error tells you that you’re doing something wrong. By.CLASS_NAME locator strategy To begin with,…

Categories
Automated testing Pytest Python

How to use pytest fixture with arguments

Pytest fixtures are a very handy tool. Thanks to them, we avoid having to repeat the same code. Also, pytest allows you to control for which tests a fixture should be run. There is no problem as long as you want the fixture to always give you the same result. But what if each test…

Categories
Automated testing Python Selenium WebDriver

How to Implement Slow Page Scrolling with Python and Selenium

Usually, finding elements on a page with Python and Selenium is not too difficult. To do this, you just need to choose the right locator. But there are pages where even the simplest search for an element can return an error. One of the reasons for these problems are pages with lazy loading. Lazy loading…

Categories
GIS testing Python

Read contents of vector tile from mvt file

Testing a GIS platform is first and foremost data testing. One day you will need to check the data that is displayed on the map. I will try to explain how the data gets on the map without going deep into technical details. What do I mean by the data on the maps. Let’s take…

Categories
Automated testing Python Selenium WebDriver

Waits – simple way to find all the desired elements

Each test run takes place under different conditions. The connection speed is always different. The site may or may not be under load. Even the computer that run tests may, for some reason, run slower than usual. Any of these circumstances can cause tests to fail due to lack of the elements immediately after opening…

Categories
Automated testing Python Selenium WebDriver

How to use now all the WebElements you found

You found elements on the page that you need to test. Now you need to click one element and check the text of the other. Or maybe you need to check whether the element enabled or clickable. If you don’t know how to find elements of the page read my post about that: Locate web…

Categories
Automated testing Python Selenium WebDriver

Locate web elements on the sites easily

In this post I’ll describe how to find elements on the page of the site you are testing. If you need to know how to start working with Selenium WebDriver, read my post where I tell about the initial configuration of Selenium WebDriver with Python. Elements in HTML All the elements on any web page…