SeleniumBase 1.60.0

New methods and lots of optimizations

New methods:

  • self.switch_to_newest_window()
  • self.assert_elements_present(*args, **kwargs)
  • self.assert_elements(*args, **kwargs)
    -- Duplicates: self.assert_elements_visible(*args, **kwargs)

The self.switch_to_newest_window() is very useful because sometimes tests open up a new tab/window, and you need to be able to switch to the newest one easily.

The new assert methods are very useful because now you can assert multiple elements in a single assert statement. (Note the difference between "present" and "visible", as "present" allows for both hidden and visible elements.) The input can either be a list of css selectors, or individual args. Example:

from seleniumbase import BaseCase

class MyTestClass(BaseCase):

    def test_assert_list_of_elements(self):
        self.open("https://store.xkcd.com/collections/posters")
        self.assert_elements_present("head", "style", "script")
        self.assert_elements("h1", "h2", "h3")
        my_list = ["#top-menu", "#col-main", "#col-widgets"]
        self.assert_elements(my_list)

Other changes include:

  • Allow the use of conftest.py for configuring pytest.
  • Bypass data: URLs when doing link-checking for 404s.
  • Optimize JavaScript calls that require the use of jQuery.
  • Optimize Dashboard output and favicon display.
  • Update the default version of Geckodriver installed.
  • Optimize logging output.
  • Optimize some existing methods.
  • Update Python dependencies:
    -- setuptools>=56.0.0;python_version>="3.6"

Full list of additions, changes, and fixes:

Making Pie Charts on Pi Day with Pytest, SeleniumBase, and HighCharts (VIDEO)

It's a tradition among scientists and mathematicians in America to celebrate Pi Day (March 14) by eating pies. We're going to take this one step further by making pie charts that represent pies. To do this, we'll be using a few tools, such as pytest, SeleniumBase, and HighCharts. With pytest, we can run a SeleniumBase script that generates HTML with HighCharts-JS to display pie charts on web pages. Here's a video of our results:

To learn more about creating charts, see: https://seleniumbase.io/examples/chart_maker/ReadMe/

Creating html presentations with SeleniumBase (VIDEO)

Creating html presentations with SeleniumBase (VIDEO: 36 seconds)

That's right! A one-line command on the command-line will get you a boilerplate html presentation that you can run with pytest!

More info here: https://seleniumbase.io/examples/presenter/ReadMe/
And here's the link to all SeleniumBase console scripts: https://seleniumbase.io/seleniumbase/console_scripts/ReadMe/