- 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…
- 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…
- 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…
- 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,…
- 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…