Releases: seleniumbase/SeleniumBase
4.8.1 - Fix proxy with auth and refresh Python dependencies
Fix proxy with auth and refresh Python dependencies
- Fix proxy with auth.
--> This resolves #1599 - Refresh Python dependencies.
--> Refresh Python dependencies - Add more retry time for failed driver downloads.
--> The driver manager now waits an extra two seconds. - Update documentation.
To proxy with authentication in tests, you can run pytest
with:
pytest --proxy="USER:PASS@SERVER:PORT"
What's Changed
Full Changelog: v4.8.0...v4.8.1
4.8.0 - Selenium upgrade and more
Selenium upgrade and more
- Refresh Python dependencies
- Add translations for assert_text_not_visible()
- Always subprocess undetectable-chromedriver when used
- Optimize proxy mode for undetectable-chromedriver mode
- Add "DriverContext" as a Python Context Manager
- Better error-handling for taking screenshots after failures
- Improve Safari reliability
- Improve Firefox compatibility
- Improve Python 3.11 compatibility
- Update default browser window sizes
- Add a retry on failure for driver downloads
What's Changed
Full Changelog: v4.7.2...v4.8.0
4.7.2 - Python 3.11 updates and more
Python 3.11 updates and more
- Fix
save_teardown_screenshot()
for Python 3.11
--> This resolves #1593 - Improve methods that scroll to elements.
- Prevent extra waiting of Safari tests in Demo Mode.
What's Changed
Full Changelog: v4.7.1...v4.7.2
4.7.1 - Python 3.11 Official Support
Python 3.11 Official Support
- Add "--no-screenshot" option to skip saving screenshots.
--> This resolves #1591 - Improve Python 3.11 compatibility
--> This resolves #1590 - Improve browser compatibility.
--> This resolves #1588 - Improve undetectable mode compatibility.
--> This resolves #1586 - Update plugins.
- Refresh Python dependencies.
--> d8b0032
What's Changed
Full Changelog: v4.7.0...v4.7.1
4.7.0 - Wire integration, UC updates, new console methods, and more
Wire integration, UC updates, new console methods, and more
- Add support for the
selenium-wire
library
--> This resolves #1574 - Prevent setting
user_data_dir
twice when usinguc
mode
--> This resolves #1569 - Handle UC Mode when used with incompatible modes
--> This resolves #1579 - Raise
VisualException
for visual diff assertion failures
--> This resolves #1577 - Add more
exclude
options forself.assert_no_js_errors()
--> This resolves #1576 - Update the
SB
context manager andDriver
manager
--> This resolves #1582 - Add
sbase
shortcuts forseleniumbase
--> This resolves #1581 - Add new methods for console log interaction
--> This resolves #1575 - Backport
ExceptionGroup
to earlier Python versions
--> This resolves #1580 - Upgrade
pytest
to7.2.0
to get all the new improvements
--> This resolves #1578
What's Changed
Full Changelog: v4.6.6...v4.7.0
4.6.6 - All kinds of updates
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
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 usingpytest
What's Changed
Full Changelog: v4.6.4...v4.6.5
4.6.4 - Add arg for excluding URLs from assert_no_js_errors()
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
Full Changelog: v4.6.3...v4.6.4
4.6.3 - Flexible Driver Manager
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
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