SDET Unicorns

Get familiar with the SeleniumBase API

Table of Content

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 SeleniumBase API 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. So, you do not have to worry about adding waits or sleeps after every other command, as all of that gets dealt with by SeleniumBase APIs.

You can also take advantage of the SeleniumBase helper methods to write your tests quickly and effectively.

Scenario #1 – Click on a button and assert url

        # click on the get started button and assert the url"#get-started")

        # get the current url of the page
        get_started_url = self.get_current_url()

        # assertion option 1
        self.assert_equal(get_started_url, "")

        # assertion option 2
        self.assert_true("get-started" in get_started_url)

Scenario #2 – Scroll and assert the text of the element

        # scroll to the bottom of the screen and assert the text

        # assert the text of the element provided
        self.assert_text("Copyright © 2020 Automation Bro", ".tg-site-footer-section-1")

Check out the video below to learn more about the SeleniumBase APIs –

I hope this post helped you out, let me know if you have any questions in the comments below!

Happy testing! 

My Resources

Thrive Suite: The all-in-one WordPress theme I used to create my blog.
Jasper AI: My favorite AI writing tool.
Surfer SEO:  A tool to help you rank your content on the first page of Google.

Write Content Faster


Write blog posts that rank for affiliate terms!

Join our mailing list

Unlock the Secrets to Becoming a SDET Pro in the Industry!

Stay ahead of the curve! Join our mailing list for exclusive insights, tips, and the latest industry updates delivered straight to your inbox

Table of Content

Related Post

equivalence and boundary value

Understanding Equivalence Partitioning and Boundary Value Analysis in Software Testing

Software testing techniques help ensure software quality and reliability, by helping us select test cases intelligently from the collection of test cases, such that all test scenarios are covered.

Boundary Value Analysis and Equivalence Partitioning are two testing techniques that help testers select a subset of test cases that covers all important test scenarios, even under time and budget constraints. By testing all the equivalence classes and boundary values, testers can reduce the risk of releasing software with defects.

Read More »