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 configuringpytest
. - 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"