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

Functional vs Regression Testing

Functional Testing vs Regression Testing: Main Differences

Testing has increasingly become a requirement in the software development lifecycle in recent years. The realization that development is no longer a focal point for stakeholders but saving costs by catching defects early in their application makes it necessary to learn different testing types.

Read More »