Skip to content

Refresh dependencies and examples #2538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/boilerplates/samples/google_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class GoogleTests(BaseCase):
def test_google_dot_com(self):
if self.headless and self._multithreaded:
self.open_if_not_url("about:blank")
print("Skipping test in headless multi-threaded mode.")
print("\n Skipping test in headless multi-threaded mode.")
self.skip("Skipping test in headless multi-threaded mode.")
self.open("https://google.com/ncr")
self.assert_title_contains("Google")
Expand Down
2 changes: 1 addition & 1 deletion examples/boilerplates/samples/test_page_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MyTests(BaseCase):
def test_page_objects(self):
if self.headless and self._multithreaded:
self.open_if_not_url("about:blank")
print("Skipping test in headless multi-threaded mode.")
print("\n Skipping test in headless multi-threaded mode.")
self.skip("Skipping test in headless multi-threaded mode.")
search_term = "SeleniumBase.io Docs"
expected_text = "SeleniumBase"
Expand Down
5 changes: 2 additions & 3 deletions examples/github_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ class GitHubTests(BaseCase):
def test_github(self):
if self.headless or self.page_load_strategy == "none":
self.open_if_not_url("about:blank")
message = "Unsupported mode for this test."
print("\n " + message)
self.skip(message)
print("\n Unsupported mode for this test.")
self.skip("Unsupported mode for this test.")
self.open("https://github.com/seleniumbase/SeleniumBase")
self.click_if_visible('[data-action="click:signup-prompt#dismiss"]')
self.highlight("div.Layout-main")
Expand Down
14 changes: 3 additions & 11 deletions examples/proxy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@

class ProxyTests(BaseCase):
def test_proxy(self):
if self.headless:
if self.headless or self.recorder_mode or self.browser == "safari":
self.open_if_not_url("about:blank")
print("Skipping test in Headless Mode.")
self.skip("Skipping test in Headless Mode.")
elif self.recorder_mode:
self.open_if_not_url("about:blank")
print("Skipping test in Recorder Mode.")
self.skip("Skipping test in Recorder Mode.")
elif self.browser == "safari":
self.open_if_not_url("about:blank")
print("Skipping test for using Safari.")
self.skip("Skipping test for using Safari.")
print("\n Unsupported mode for this test.")
self.skip("Unsupported mode for this test.")
settings.SKIP_JS_WAITS = True
if not self.page_load_strategy == "none" and not self.undetectable:
# This page takes too long to load otherwise
Expand Down
10 changes: 3 additions & 7 deletions examples/rate_limiting_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ def print_item(self, item):
print(item)

def test_rate_limited_printing(self):
if self._multithreaded:
if self._multithreaded or self.recorder_mode:
self.open_if_not_url("about:blank")
print("Skipping test in multi-threaded mode.")
self.skip("Skipping test in multi-threaded mode.")
if self.recorder_mode:
self.open_if_not_url("about:blank")
print("Skipping test in Recorder Mode.")
self.skip("Skipping test in Recorder Mode.")
print("\n Unsupported mode for this test.")
self.skip("Unsupported mode for this test.")
message = "Running rate-limited print() on the command line"
self.open("data:text/html,<p>%s</p>" % message)
print("\n%s:" % message)
Expand Down
12 changes: 3 additions & 9 deletions examples/shadow_root_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@

class ShadowRootTest(BaseCase):
def test_shadow_root(self):
if self.recorder_mode:
if self.recorder_mode or not self.is_chromium():
self.open_if_not_url("about:blank")
message = "Skipping test in Recorder Mode."
print(message)
self.skip(message)
elif not self.is_chromium():
self.open_if_not_url("about:blank")
message = "This test is only for Chromium browsers!"
print(message)
self.skip(message)
print("\n Unsupported mode for this test.")
self.skip("Unsupported mode for this test.")
self.open("https://seleniumbase.io/other/shadow_dom")
print("")
self.click("button.tab_1")
Expand Down
18 changes: 6 additions & 12 deletions examples/test_apple_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@ def test_apple_developer_site_webdriver_instructions(self):
self.demo_mode = True
self.demo_sleep = 0.5
self.message_duration = 2.0
if self.is_chromium() and not self.disable_csp:
self.get_new_driver(browser=self.browser, disable_csp=True)
if self.headless:
if self._multithreaded:
if self._multithreaded or self.undetectable or self.recorder_mode:
self.open_if_not_url("about:blank")
print("Skipping test in headless multi-threaded mode.")
self.skip("Skipping test in headless multi-threaded mode.")
elif self.undetectable:
self.open_if_not_url("about:blank")
print("Skipping test in headless undetectable mode.")
self.skip("Skipping test in headless undetectable mode.")
elif self.recorder_mode:
self.open_if_not_url("about:blank")
print("Skipping test in headless Recorder Mode.")
self.skip("Skipping test in headless Recorder Mode.")
elif self.browser == "chrome" or self.browser == "edge":
print("\n Unsupported mode for this test.")
self.skip("Unsupported mode for this test.")
elif self.is_chromium():
self.get_new_driver(browser=self.browser, headless2=True)
self.open("https://developer.apple.com/search/")
title = "Testing with WebDriver in Safari"
Expand Down
2 changes: 1 addition & 1 deletion examples/test_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_click_with_offset(self):
self.open("https://seleniumbase.io/canvas/")
if self.undetectable:
self.open_if_not_url("about:blank")
print("Skip this test in undetectable mode.")
print("\n Skip this test in undetectable mode.")
self.skip("Skip this test in undetectable mode.")
self.assert_title_contains("Canvas")
self.highlight("canvas")
Expand Down
3 changes: 1 addition & 2 deletions examples/test_chromedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

class ChromedriverTests(BaseCase):
def test_chromedriver_matches_chrome(self):
self.open("about:blank")
if self.browser != "chrome":
self.open_if_not_url("data:,")
print("\n This test is only for Chrome!")
print(' (Run with: "--browser=chrome")')
self.skip("This test is only for Chrome!")
chrome_version = self.get_chrome_version()
major_chrome_version = chrome_version.split(".")[0]
Expand Down
4 changes: 2 additions & 2 deletions examples/test_hack_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class HackingTests(BaseCase):
def test_hack_search(self):
if self.headless:
self.open_if_not_url("about:blank")
print("\n This test is not for Headless Mode.")
self.skip('Do not use "--headless" with this test.')
print("\n Skipping test in headless mode.")
self.skip('Skipping test in headless mode.')
self.open("https://google.com/ncr")
self.hide_elements("iframe")
self.assert_element('[title="Search"]')
Expand Down
5 changes: 2 additions & 3 deletions examples/test_multiple_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ class MultipleDriversTest(BaseCase):
def test_multiple_drivers(self):
if self.browser == "safari":
self.open_if_not_url("about:blank")
message = "Safari doesn't support multiple drivers."
print(message)
self.skip(message)
print("\n Safari doesn't support multiple drivers.")
self.skip("Safari doesn't support multiple drivers.")
self.open("data:text/html,<h1>Driver 1</h1>")
driver2 = self.get_new_driver()
self.open("data:text/html,<h1>Driver 2</h1>")
Expand Down
8 changes: 6 additions & 2 deletions examples/test_override_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class OverrideDriverTest(BaseCase):
def get_new_driver(self, *args, **kwargs):
"""This method overrides get_new_driver() from BaseCase."""
options = webdriver.ChromeOptions()
options.add_argument("--disable-3d-apis")
options.add_argument("--disable-notifications")
if self.headless:
options.add_argument("--headless=new")
Expand All @@ -24,4 +23,9 @@ def get_new_driver(self, *args, **kwargs):

def test_driver_override(self):
self.open("https://seleniumbase.io/demo_page")
self.assert_text("Demo Page", "h1")
self.type("#myTextInput", "This is Automated")
self.set_value("input#mySlider", "100")
self.select_option_by_text("#mySelect", "Set to 100%")
self.click("#checkBox1")
self.drag_and_drop("img#logo", "div#drop2")
self.click('button:contains("Click Me")')
18 changes: 17 additions & 1 deletion examples/test_override_sb_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ class BaseClass(BaseCase):
def get_new_driver(self, *args, **kwargs):
"""This method overrides get_new_driver() from BaseCase."""
options = webdriver.ChromeOptions()
options.add_argument("--disable-notifications")
if self.headless:
options.add_argument("--headless=new")
options.add_argument("--disable-gpu")
options.add_experimental_option(
"excludeSwitches", ["enable-automation"],
"excludeSwitches", ["enable-automation", "enable-logging"],
)
prefs = {
"credentials_enable_service": False,
"profile.password_manager_enabled": False,
}
options.add_experimental_option("prefs", prefs)
return webdriver.Chrome(options=options)

def setUp(self):
Expand Down Expand Up @@ -63,9 +69,19 @@ def tearDown(self):
def test_override_fixture_no_class(sb):
sb.open("https://seleniumbase.io/demo_page")
sb.type("#myTextInput", "This is Automated")
sb.set_value("input#mySlider", "100")
sb.select_option_by_text("#mySelect", "Set to 100%")
sb.click("#checkBox1")
sb.drag_and_drop("img#logo", "div#drop2")
sb.click('button:contains("Click Me")')


class TestOverride:
def test_override_fixture_inside_class(self, sb):
sb.open("https://seleniumbase.io/demo_page")
sb.type("#myTextInput", "This is Automated")
sb.set_value("input#mySlider", "100")
sb.select_option_by_text("#mySelect", "Set to 100%")
sb.click("#checkBox1")
sb.drag_and_drop("img#logo", "div#drop2")
sb.click('button:contains("Click Me")')
16 changes: 4 additions & 12 deletions examples/test_shadow_dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,10 @@ def download_tar_file_from_pypi(self, package):
return tar_file

def test_shadow_dom(self):
if self.browser != "chrome":
self.open("about:blank")
print("\n This test is for Google Chrome only!")
self.skip("This test is for Google Chrome only!")
if self.headless:
self.open("about:blank")
print("\n This test doesn't run in headless mode!")
self.skip("This test doesn't run in headless mode!")
if self.recorder_mode:
self.open("about:blank")
print("Skipping test in Recorder Mode.")
self.skip("Skipping test in Recorder Mode.")
if not self.browser == "chrome" or self.headless or self.recorder_mode:
self.open_if_not_url("about:blank")
print("\n Unsupported mode for this test.")
self.skip("Unsupported mode for this test.")

# Download Python package files from PyPI
file_name_1 = self.download_tar_file_from_pypi("sbase")
Expand Down
4 changes: 1 addition & 3 deletions examples/test_verify_chromedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@

class ChromedriverTests(BaseCase):
def test_fail_if_versions_dont_match(self):
self.open("data:,")
self.open("about:blank")
if self.browser != "chrome":
self.open_if_not_url("data:,")
print("\n This test is only for Chrome!")
print(" (Run with: '--chrome')")
self.skip("This test is only for Chrome!")
chrome_version = self.get_chrome_version()
major_chrome_version = chrome_version.split(".")[0]
Expand Down
14 changes: 5 additions & 9 deletions examples/youtube_search_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@
class YouTubeSearchTests(BaseCase):
def test_youtube_autocomplete_results(self):
"""Verify YouTube autocomplete search results."""
if self.headless:
if self.headless or self.browser == "safari":
self.open_if_not_url("about:blank")
message = "This test is skipped in headless mode."
print(message)
self.skip(message)
elif self.browser == "safari":
self.open_if_not_url("about:blank")
message = "This test is skipped when using Safari."
print(message)
self.skip(message)
print("\n Unsupported mode for this test.")
self.skip("Unsupported mode for this test.")
self.open("https://www.youtube.com/c/MichaelMintz")
search_term = "seleniumbase"
search_selector = "input#search"
result_selector = 'li[role="presentation"]'
self.click_if_visible('button[aria-label="Close"]')
self.double_click(search_selector)
self.sleep(0.15)
self.type(search_selector, search_term)
self.sleep(0.15)
# First verify that an autocomplete result exists
self.assert_element(result_selector)
top_result = self.get_text(result_selector)
Expand Down
6 changes: 3 additions & 3 deletions mkdocs_build/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

regex>=2023.12.25
pymdown-extensions>=10.7
pipdeptree>=2.14.0
pipdeptree>=2.15.1
python-dateutil>=2.8.2
Markdown==3.5.2
markdown2==2.4.12
markdown2==2.4.13
MarkupSafe==2.1.5
Jinja2==3.1.3
click==8.1.7
Expand All @@ -20,7 +20,7 @@ lxml==5.1.0
pyquery==2.0.0
readtime==3.0.0
mkdocs==1.5.3
mkdocs-material==9.5.10
mkdocs-material==9.5.11
mkdocs-exclude-search==0.6.6
mkdocs-simple-hooks==0.1.5
mkdocs-material-extensions==1.3.1
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
pip>=24.0
packaging>=23.2
setuptools>=68.0.0;python_version<"3.8"
setuptools>=69.1.0;python_version>="3.8"
setuptools>=69.1.1;python_version>="3.8"
wheel>=0.42.0
attrs>=23.2.0
certifi>=2024.2.2
filelock>=3.12.2;python_version<"3.8"
filelock>=3.13.1;python_version>="3.8"
platformdirs>=4.0.0;python_version<"3.8"
platformdirs>=4.2.0;python_version>="3.8"
typing-extensions>=4.9.0;python_version>="3.8"
typing-extensions>=4.10.0;python_version>="3.8"
parse>=1.20.1
parse-type>=0.6.2
pyyaml>=6.0.1
Expand All @@ -21,7 +21,7 @@ urllib3>=1.26.18,<2;python_version<"3.10"
urllib3>=1.26.18,<2.3.0;python_version>="3.10"
requests==2.31.0
pynose==1.5.0
sniffio==1.3.0
sniffio==1.3.1
h11==0.14.0
outcome==1.3.0.post0
trio==0.22.2;python_version<"3.8"
Expand All @@ -39,7 +39,7 @@ pluggy==1.2.0;python_version<"3.8"
pluggy==1.4.0;python_version>="3.8"
py==1.11.0
pytest==7.4.4;python_version<"3.8"
pytest==8.0.1;python_version>="3.8"
pytest==8.0.2;python_version>="3.8"
pytest-html==2.0.1
pytest-metadata==3.0.0;python_version<"3.8"
pytest-metadata==3.1.1;python_version>="3.8"
Expand Down Expand Up @@ -69,7 +69,7 @@ rich==13.7.0

coverage==6.2;python_version<"3.7"
coverage==7.2.7;python_version>="3.7" and python_version<"3.8"
coverage==7.4.2;python_version>="3.8"
coverage==7.4.3;python_version>="3.8"
pytest-cov==4.0.0;python_version<"3.7"
pytest-cov==4.1.0;python_version>="3.7"
flake8==5.0.4;python_version<"3.9"
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.24.0"
__version__ = "4.24.1"
Loading