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
        self.click("#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, "https://practice.automationbro.com/#get-started")

        # 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
        self.scroll_to_bottom()

        # 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

5/5

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

7 Principles of Software Testing

7 Principles of Software Testing with Examples

Software testing plays a crucial role in the software development life cycle as it helps ensure the quality, reliability, and performance of the final product. Software testing is not just about finding defects; it also provides valuable insights into the overall quality of the software. By conducting effective software testing, it shows how well the application behaves in different scenarios and whether it meets user expectations.

Read More »
Differences Between CI/CD and DevOps

Key Differences Between CI/CD and DevOps

Software development is far from a simple journey that involves merely executing code and launching applications. It often presents challenges, as it’s rare to get everything right from the start. Each time you implement new or frequent code changes, you inadvertently introduce potential issues that can be time-consuming to resolve. This complexity necessitates a structured approach to ensure smooth production.

Read More »