Image for post
Image for post
https://youtu.be/x-w2Oq99J_0

In this post, we will take a look at how we can generate a screenshot of a test failure in Selenium Python so that we can quickly look at the screenshot and identify what was the state of our application at that moment.

We will also learn how to take screenshots whenever we want for a certain part of the screen and these screenshots can then be reviewed by your team for manual validation if needed.

Taking screenshot of failed tests

One of the many great features of using the SeleniumBase framework is that it comes with in-built screenshot generation capability when a test fails…


Image for post
Image for post
https://youtu.be/3V1HNR9qJXM

In this post, we will take a look at how to do exception handling using Selenium Python and the SeleniumBase framework. So, before we see how we can do that let’s talk about why you need to handle exceptions in the first place, usually if there’s an error within your test you would want the test to fail and that is true for 95% of the scenarios.

But, you will run into certain scenarios where you will encounter an error and you would want to handle that differently instead of just throwing the error and failing your test.

For example…


Image for post
Image for post
https://youtu.be/7l88MW-2Wlw

In this post, we will learn about the various wait commands available in Selenium Python using the SeleniumBase framework. Using wait commands when doing browser automation is inevitable. Therefore, it’s important to understand how to use wait commands the right way.

Using “Wait” the Wrong way

Now, this one, in particular, is a pet-peeve of mine. I have seen time and again in many codebases where hard-coded sleeps are used instead of implementing the right wait commands. I am sure you have seen this before as well or a variation of the code below –


Image for post
Image for post
https://youtu.be/W5wHDPzSl1M

In this post, we will learn what is Page Object Model and how to implement the Page Object Model with Selenium Python. Page Object pattern has been around for many years and is usually considered as one of the best practices to follow in the test automation industry.

What is Page Object Model (POM)?

POM is a design pattern that makes it easier for us to maintain our code and reduce code duplication. It allows you to abstract any page related information away from your actual tests.

So to put it simply, all the selectors that are within your tests, we can extract that away and…


Image for post
Image for post

WebdriverIO recently came out with v7, in this post, I will quickly go over some of the high-level changes that are part of this release. I will also cover how you can upgrade your WebdriverIO v6 project to v7.

WebdriverIO v7

TypeScript Rewrite — The biggest change they have made for this release is that they have rewritten all the WebdriverIO code in Typescript. Now if you are a Typescript lover, this is great news for you as you will get better type support with WebdriverIO now.

For everyone else that is still using JavaScript with WebdriverIO, it’s still good news as…


Image for post
Image for post
https://youtu.be/uZ-sgPTM0eM

In this post, we will learn how we can use SeleniumBase Setup & Teardown methods to optimize our tests even further. If you are not familiar with setup & teardown concepts, essentially, it allows you to run certain steps before and after your actual test.

So, when you run the Setup method, it will trigger the steps BEFORE your test will run and the TearDown will run the steps AFTER your test has finished.

Setup Method

The setup method will run the steps before each of your tests. Let’s take a look at the sample code below –


Image for post
Image for post

In this post, we will learn how to upload a file using Selenium Webdriver in Python as well as using the SeleniumBase framework. File uploads are common use cases for the majority of websites these days, so it is important to know how to work with them.

Typically, you’ll run into two scenarios when working with file uploads. 1 — where the file input field is visible. 2 — where the file input field is hidden (most common in modern websites). Let’s take a look at an example for both of them –

Upload file on a visible input field

For this example, I will be using…


Image for post
Image for post
https://youtu.be/DlZH8f0dc4E

One of the most common scenarios that you will run into as part of browser automation is filling the input fields. In this tutorial, we will cover how to work with input text elements in Selenium Python using the SeleniumBase framework.

Test Scenario

In this test, we will be filling all the fields below and clicking the submit button to submit the contact form.


Image for post
Image for post
https://www.youtube.com/watch?v=Yvt28OCzWhI

During browser automation, you’ll often run into scenarios where you will need to work with multiple elements such as when dealing with menu links lists, dropdown lists, etc… In this tutorial, we will cover how to find multiple elements in Selenium Python using the SeleniumBase framework.

Test Scenario

Get the text of all the menu link items below and assert the value.


Image for post
Image for post

SeleniumBase framework comes with a set of pre-defined APIs or helper methods for us to use. In this post, we will get familiar with some of the common APIs such as click, get_text, assert_text, etc… and understand how it works and which ones to use when.

💭 Why use SeleniumBase API?

SeleniumBase API provides us with helper wrapper methods to use that are built on top of regular selenium commands. These wrapper methods make working with Selenium a lot easier as it comes with in-built smart wait features to make your tests more reliable. …

Automation Bro

SDET Architect | YouTuber | Tech Blogger | Love to explore new tools and technologies. Check out my YouTube channel — https://youtube.com/automationbro

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store