Skip to content

Releases: seleniumbase/SeleniumBase

4.6.6 - All kinds of updates

25 Oct 06:40
4bb3a0a

Choose a tag to compare

All kinds of updates

  • Refactor Undetectable Mode
  • Add option to enable WebGL and 3D APIs (--enable-3d-apis)
  • Add option to use Undetectable Mode with Recorder
  • Add wait_for_query_selector() method
  • Refresh Python dependencies

What's Changed

Full Changelog: v4.6.5...v4.6.6

4.6.5 - Update default settings for Undetected Mode

21 Oct 23:39
64ebebe

Choose a tag to compare

Update default settings for Undetected Mode

  • Update default settings for Undetected Mode (--uc):
    --> Use a subprocess for pure Python syntax formats
    --> (pytest tests still need to use --uc-sub)
  • Check if an attribute is defined before using it:
    --> This fixes an issue when not using pytest

What's Changed

  • Update default settings for Undetected Mode by @mdmintz in #1556

Full Changelog: v4.6.4...v4.6.5

4.6.4 - Add arg for excluding URLs from assert_no_js_errors()

20 Oct 22:58
1d09bf3

Choose a tag to compare

Add arg for excluding URLs from assert_no_js_errors()

  • Add arg for excluding URLs from assert_no_js_errors()

    def assert_no_js_errors(self, exclude=[]):
        """Asserts current URL has no "SEVERE"-level JavaScript errors.
        Works ONLY on Chromium browsers (Chrome or Edge).
        Does NOT work on Firefox, IE, Safari, or some other browsers:
            * See https://github.com/SeleniumHQ/selenium/issues/1161
        Based on the following Stack Overflow solution:
            * https://stackoverflow.com/a/41150512/7058266
        @Params
        exclude -->
            A list of substrings or a single comma-separated string of
            substrings for filtering out error URLs that contain them.
            URLs that contain any excluded substring will get excluded
            from the final errors list that's used with the assertion.
        Examples:
            self.assert_no_js_errors()
            self.assert_no_js_errors(exclude=["/api.", "/analytics."])
            self.assert_no_js_errors(exclude="//api.go,/analytics.go")
        """

What's Changed

  • Add arg for excluding URLs from assert_no_js_errors() by @mdmintz in #1555

Full Changelog: v4.6.3...v4.6.4

4.6.3 - Flexible Driver Manager

20 Oct 04:36
4f20c34

Choose a tag to compare

Flexible Driver Manager

  • Make the standalone Driver Manager more flexible.
    --> More options when using the Driver Manager without BaseCase.
    --> Added shorter method names as duplicates for some methods.
  • Refresh Python dependencies.
    --> e6e0971

The driver manager (via context manager)

This pure Python format gives you a raw webdriver instance in a with block. The SeleniumBase Driver Manager will automatically make sure that your driver is compatible with your browser version. It gives you full access to customize driver options via method args or via the command-line. The driver will automatically call quit() after the code leaves the with block. Here are some examples:

"""This script can be run with pure "python". (pytest not needed)."""
from seleniumbase import js_utils
from seleniumbase import page_actions
from seleniumbase import Driver

# Python Context Manager
with Driver() as driver:  # By default, browser="chrome"
    driver.get("https://google.com/ncr")
    js_utils.highlight_with_js(driver, 'img[alt="Google"]', 6, "")

with Driver() as driver:  # Also accepts command-line options
    driver.get("https://seleniumbase.github.io/demo_page")
    js_utils.highlight_with_js(driver, "h2", 5, "")
    by_css = "css selector"
    driver.find_element(by_css, "#myTextInput").send_keys("Automation")
    driver.find_element(by_css, "#checkBox1").click()
    js_utils.highlight_with_js(driver, "img", 5, "")

# Python Context Manager (with options given)
with Driver(browser="chrome", incognito=True) as driver:
    driver.get("https://seleniumbase.io/apps/calculator")
    page_actions.wait_for_element(driver, "4", "id").click()
    page_actions.wait_for_element(driver, "2", "id").click()
    page_actions.wait_for_text(driver, "42", "output", "id")
    js_utils.highlight_with_js(driver, "#output", 6, "")

(See examples/raw_driver.py for an example.)

The driver manager (via direct import)

Another way of running Selenium tests with pure python (as opposed to using pytest or nosetests) is by using this format, which bypasses BaseCase methods while still giving you a flexible driver with a manager. SeleniumBase includes helper files such as page_actions.py, which may help you get around some of the limitations of bypassing BaseCase. Here's an example:

"""This script can be run with pure "python". (pytest not needed)."""
from seleniumbase import Driver
from seleniumbase import js_utils
from seleniumbase import page_actions

# Example with options. (Also accepts command-line options.)
driver = Driver(browser="chrome", headless=False)
try:
    driver.get("https://seleniumbase.io/apps/calculator")
    page_actions.wait_for_element(driver, "4", "id").click()
    page_actions.wait_for_element(driver, "2", "id").click()
    page_actions.wait_for_text(driver, "42", "output", "id")
    js_utils.highlight_with_js(driver, "#output", 6, "")
finally:
    driver.quit()

# Example 2 using default args or command-line options
driver = Driver()
driver.get("https://seleniumbase.github.io/demo_page")
js_utils.highlight_with_js(driver, "h2", 5, "")
by_css = "css selector"
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
driver.find_element(by_css, "#checkBox1").click()
js_utils.highlight_with_js(driver, "img", 5, "")
driver.quit()  # If the script fails early, the driver still quits

(From examples/raw_browser_launcher.py)

The above format can be used as a drop-in replacement for virtually every Python/selenium framework, as it uses the raw driver instance for handling commands. The Driver() method simplifies the work of managing drivers with optimal settings, and it can be configured via multiple method args. The Driver also accepts command-line options (such as python --headless) so that you don't need to modify your tests directly to use different settings. These command-line options only take effect if the associated method args remain unset (or set to None) for the specified options.

What's Changed

Full Changelog: v4.6.2...v4.6.3

4.6.2 - Update the console width method

14 Oct 20:29
eb9832f

Choose a tag to compare

Update the console width method

  • Update the method that returns the console width.
    --> This resolves #1551

What's Changed

Full Changelog: v4.6.1...v4.6.2

4.6.1 - Fix console width issue with SB Manager

14 Oct 19:24
a78d440

Choose a tag to compare

Fix console width issue with SB Manager

  • Fix issue with getting console width.
    --> This resolves #1549
  • Fix issue with printing during multi-process runs.
    --> b7dc6e9
  • Refresh Python dependencies.
    --> cd620db

What's Changed

Full Changelog: v4.6.0...v4.6.1

4.6.0 - Context Managers and more

14 Oct 08:12
c406380

Choose a tag to compare

Context Managers and more

  • Add support for SeleniumBase as a Context Manager
    --> This resolves #1547
  • Add support for the SeleniumBase Driver Manager as a Context Manager
    --> This resolves #1546
  • Add support for undetected-chromedriver as a subprocess.
  • Add timeout options to click_if_visible() methods.
  • Improve output for downloading drivers.
  • Update output of visual comparisons.
  • Update default driver versions.
  • Update console scripts.

What's Changed

Full Changelog: v4.5.6...v4.6.0

4.5.6 - Performance Testing decorators

11 Oct 00:07
e8eb0c6

Choose a tag to compare

Performance Testing decorators

  • Add Python decorators for performance testing
    --> 06c1959
    --> This resolves #1544
  • Refresh Python dependencies
    --> d69964b
  • Update tests with examples of performance testing
    --> 759423a

  • print_runtime(description=None, limit=None)
  • runtime_limit(limit, description=None)

  • print_runtime(description=None, limit=None)

Print the total runtime of the method / function or code block. The description option can be used for organizing the output when a test calls this multiple times. The limit option can be used to optionally set a time limit so that the test fails if the decorated code block takes longer than the time limit to complete (after it completes).

Method / Function example usage ->

from seleniumbase import decorators

@decorators.print_runtime("My Method")
def my_method():
    # code ...
    # code ...

with-block example usage ->

from seleniumbase import decorators

with decorators.print_runtime("My Code Block"):
    # code ...
    # code ...

  • runtime_limit(limit, description=None)

Fail if the runtime duration of a method or "with"-block exceeds the limit. (The failure won't occur until after the method or "with"-block completes.) The description option can be used for making the output more clear about which code block failed.

Method / Function example usage ->

from seleniumbase import decorators

@decorators.runtime_limit(4.5)
def my_method():
    # code ...
    # code ...

``with``-block example usage ->

```python
from seleniumbase import decorators

with decorators.runtime_limit(32):
    # code ...
    # code ...

What's Changed

Full Changelog: v4.5.5...v4.5.6

4.5.5 - Add option to disable JavaScript in tests

06 Oct 05:34
db0ac9b

Choose a tag to compare

Add option to disable JavaScript in tests

  • Add option to disable JavaScript during tests:
    --> 99b63cd
    --> This resolves #1542
    --> --disable-js

What's Changed

Full Changelog: v4.5.4...v4.5.5

4.5.4 - Fix all known bugs (up to this point)

04 Oct 03:53
ab43a74

Choose a tag to compare

Fix all known bugs (up to this point)

  • Fix issue with loading more data than needed.
    --> This resolves #1540
  • Fix issue with the "behave" Dashboard and GUI App
    --> This resolves #1539
  • Refactoring.
    --> Includes fixes for bugs on older versions of Python.

What's Changed

Full Changelog: v4.5.3...v4.5.4