From 7f937365d93263cc2b19f8501e76bb27597b20df Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Wed, 10 Jun 2026 01:37:15 -0400 Subject: [PATCH 1/4] Update the self-hosted dashboard --- seleniumbase/fixtures/base_case.py | 20 +++++++++++++++++++- seleniumbase/fixtures/constants.py | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index d274dc72037..714819b7d71 100644 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -16551,15 +16551,33 @@ def __process_dashboard(self, has_exception, init=False): "%s" % (DASH_PIE_PNG_1, auto_refresh_html, style) ) + num_total = num_passed + num_failed + num_skipped + num_untested table_html = ( "
" - '' + '' + '' + '' + '' + '' + '' + '' + "
' + 'Failed: %s' + 'Skipped: %s' + 'Passed: %s' + 'Untested: %s' + 'Total: %s
" + "

" + '' '' '' '' '' "" + % (num_failed, num_skipped, num_passed, num_untested, num_total) ) the_failed = [] the_skipped = [] diff --git a/seleniumbase/fixtures/constants.py b/seleniumbase/fixtures/constants.py index 6bfe749ec95..061fd2c0f18 100644 --- a/seleniumbase/fixtures/constants.py +++ b/seleniumbase/fixtures/constants.py @@ -104,7 +104,7 @@ class Recordings: class Dashboard: - TITLE = "SeleniumBase Dashboard ⚪" + TITLE = "SeleniumBase Dashboard 📊" # STYLE_CSS = "https://seleniumbase.io/cdn/css/pytest_style.css" STYLE_CSS = "assets/pytest_style.css" # Generated before tests META_REFRESH_HTML = '' From 532cc63228ed520d1df714d072fd2f01ac4fc9bf Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Wed, 10 Jun 2026 01:45:25 -0400 Subject: [PATCH 2/4] Refactor code, examples, and docs --- README.md | 27 ++++--- examples/basic_test.py | 2 +- examples/behave_bdd/ReadMe.md | 2 +- .../behave_bdd/features/steps/calculator.py | 2 +- .../behave_bdd/features/steps/fail_page.py | 2 +- .../behave_bdd/features/steps/swag_labs.py | 2 +- examples/boilerplates/classic_obj_test.py | 2 +- examples/boilerplates/samples/google_test.py | 7 +- examples/boilerplates/samples/sb_swag_test.py | 2 +- .../boilerplates/samples/swag_labs_test.py | 2 +- .../boilerplates/samples/test_page_objects.py | 10 +-- examples/boilerplates/sb_fixture_test.py | 2 +- examples/cdp_mode/ReadMe.md | 16 ++-- examples/cdp_mode/playwright/ReadMe.md | 12 ++- .../cdp_mode/playwright/raw_indeed_sync.py | 2 +- .../cdp_mode/playwright/raw_walmart_sync.py | 2 +- examples/cdp_mode/raw_ad_blocking.py | 2 +- examples/cdp_mode/raw_async.py | 2 +- examples/cdp_mode/raw_basic_async.py | 2 +- examples/cdp_mode/raw_basic_cdp.py | 2 +- examples/cdp_mode/raw_browserscan.py | 2 +- examples/cdp_mode/raw_cdp_browserscan.py | 2 +- examples/cdp_mode/raw_cdp_copilot.py | 2 +- examples/cdp_mode/raw_cdp_extended.py | 2 +- examples/cdp_mode/raw_cdp_fingerprint.py | 2 +- examples/cdp_mode/raw_cdp_gitlab.py | 2 +- examples/cdp_mode/raw_cdp_hyatt.py | 2 +- examples/cdp_mode/raw_cdp_login.py | 2 +- examples/cdp_mode/raw_cdp_methods.py | 2 +- examples/cdp_mode/raw_cdp_mobile.py | 2 +- examples/cdp_mode/raw_cdp_nike.py | 2 +- examples/cdp_mode/raw_cdp_nordstrom.py | 2 +- examples/cdp_mode/raw_cdp_pixelscan.py | 2 +- examples/cdp_mode/raw_cdp_recaptcha.py | 2 +- examples/cdp_mode/raw_cdp_sannysoft.py | 2 +- examples/cdp_mode/raw_cdp_tabs.py | 6 +- examples/cdp_mode/raw_cdp_tavus.py | 2 +- examples/cdp_mode/raw_cdp_timezone.py | 4 +- examples/cdp_mode/raw_cdp_turnstile.py | 2 +- examples/cdp_mode/raw_cdp_walmart.py | 2 +- examples/cdp_mode/raw_cf_clearance.py | 2 +- examples/cdp_mode/raw_consecutive_c.py | 2 +- examples/cdp_mode/raw_demo_site.py | 2 +- examples/cdp_mode/raw_driver.py | 6 +- examples/cdp_mode/raw_fingerprint.py | 2 +- examples/cdp_mode/raw_geolocation.py | 2 +- examples/cdp_mode/raw_mfa_login.py | 2 +- examples/cdp_mode/raw_mobile_agents.py | 4 +- examples/cdp_mode/raw_mobile_gitlab.py | 2 +- examples/cdp_mode/raw_mobile_roblox.py | 2 +- examples/cdp_mode/raw_multi_captcha.py | 2 +- examples/cdp_mode/raw_planetmc.py | 4 +- examples/cdp_mode/raw_pokemon.py | 2 +- examples/cdp_mode/raw_proxy.py | 14 ++-- examples/cdp_mode/raw_req_mod.py | 2 +- examples/cdp_mode/raw_req_sb.py | 2 +- examples/cdp_mode/raw_res_sb.py | 2 +- examples/cdp_mode/raw_sannysoft.py | 2 +- examples/cdp_mode/raw_sms_man.py | 2 +- examples/cdp_mode/raw_softpedia.py | 2 +- examples/cdp_mode/raw_tab_switching.py | 4 +- examples/cdp_mode/raw_tavus.py | 2 +- examples/cdp_mode/raw_theaters.py | 2 +- examples/cdp_mode/raw_timezone.py | 2 +- examples/cdp_mode/raw_timezone_sb.py | 2 +- examples/cdp_mode/raw_totalwine.py | 2 +- examples/cdp_mode/raw_xhr_sb.py | 2 +- examples/cdp_mode/raw_xpath.py | 9 ++- examples/cdp_mode/raw_zoro.py | 2 +- examples/coffee_cart_tests.py | 10 +-- examples/custom_settings.py | 2 +- examples/dialog_boxes/ReadMe.md | 4 +- examples/dialog_boxes/dialog_box_tour.py | 24 +++--- examples/edge_test.py | 6 +- examples/github_test.py | 4 +- examples/hack_the_planet.py | 42 +++++----- examples/handle_alert_test.py | 2 +- examples/iframe_tests.py | 6 +- examples/locale_code_test.py | 4 +- examples/master_qa/ReadMe.md | 6 +- examples/master_qa/basic_masterqa_test_0.py | 6 +- examples/master_qa/masterqa_test_1.py | 8 +- examples/migration/protractor/example_test.py | 4 +- examples/migration/protractor/input_test.py | 2 +- .../protractor/mat_paginator_test.py | 2 +- .../migration/raw_selenium/refined_raw.py | 4 +- .../migration/raw_selenium/simple_sbase.py | 2 +- .../01_hybrid_approach/ReadMe.md | 2 +- .../non_test_scripts/raw_script_sb.py | 2 +- .../01_hybrid_approach/raw_case_sb.py | 2 +- .../01_hybrid_approach/raw_hybrid_case.py | 2 +- .../01_hybrid_approach/raw_hybrid_fixture.py | 2 +- .../raw_hybrid_fixture_tracing.py | 2 +- .../02_adapter_pattern/ReadMe.md | 22 ++--- .../02_adapter_pattern/raw_pw_adapter.py | 4 +- .../raw_pw_adapter_with_tracing.py | 4 +- .../02_adapter_pattern/raw_sb_adapter.py | 6 +- .../02_adapter_pattern/raw_se_adapter.py | 4 +- examples/my_first_test.py | 20 ++--- examples/nth_child_test.py | 2 +- .../offline_examples/test_handle_alerts.py | 2 +- .../offline_examples/test_request_fixture.py | 4 +- examples/offline_examples/test_user_agent.py | 4 +- examples/old_wordle_script.py | 2 +- examples/parameterized_test.py | 2 +- examples/performance_test.py | 2 +- examples/presenter/ReadMe.md | 6 +- examples/presenter/core_presentation.py | 2 +- examples/presenter/edge_presentation.py | 32 ++++---- examples/presenter/fundamentals.py | 4 +- examples/presenter/hacking_with_cdp.py | 2 +- examples/presenter/multi_uc.py | 2 +- examples/presenter/my_presentation.py | 4 +- examples/presenter/ua_presentation_5.py | 4 +- examples/presenter/uc_presentation.py | 2 +- examples/presenter/uc_presentation_3.py | 8 +- examples/presenter/uc_presentation_4.py | 8 +- examples/presenter/web_scraping_on_gha.py | 6 +- examples/proxy_test.py | 6 +- examples/rate_limiting_test.py | 4 +- examples/raw_block.py | 2 +- examples/raw_brotector_captcha.py | 2 +- examples/raw_cookies.py | 6 +- examples/raw_detection.py | 2 +- examples/raw_driver_context.py | 6 +- examples/raw_driver_manager.py | 4 +- examples/raw_file_call.py | 2 +- examples/raw_form_turnstile.py | 5 +- examples/raw_games.py | 4 +- examples/raw_gui_click.py | 2 +- examples/raw_hobbit.py | 2 +- examples/raw_login_context.py | 2 +- examples/raw_login_driver.py | 2 +- examples/raw_login_sb.py | 2 +- examples/raw_main_call.py | 5 +- examples/raw_mobile.py | 2 +- examples/raw_multi_sb.py | 2 +- examples/raw_no_context_mgr.py | 4 +- examples/raw_performance_logs.py | 2 +- examples/raw_robot.py | 2 +- examples/raw_sb.py | 2 +- examples/raw_test_scripts.py | 4 +- examples/sb_fixture_tests.py | 4 +- examples/shadow_root_test.py | 4 +- examples/swag_labs_user_tests.py | 2 +- examples/test_3d_apis.py | 4 +- examples/test_apple_site.py | 4 +- examples/test_assert_elements.py | 2 +- examples/test_calculator.py | 2 +- examples/test_canvas.py | 6 +- examples/test_cdp_ad_blocking.py | 4 +- examples/test_checkboxes.py | 4 +- examples/test_chinese_pdf.py | 2 +- examples/test_chromedriver.py | 2 +- examples/test_coffee_cart.py | 2 +- examples/test_console_logging.py | 2 +- examples/test_contains_selector.py | 2 +- examples/test_cycle_elements.py | 2 +- examples/test_decryption.py | 2 +- examples/test_deferred_asserts.py | 2 +- examples/test_demo_site.py | 2 +- examples/test_detect_404s.py | 2 +- examples/test_docs_site.py | 2 +- examples/test_double_click.py | 4 +- examples/test_download_files.py | 6 +- examples/test_download_images.py | 10 +-- examples/test_drag_and_drop.py | 4 +- examples/test_error_page.py | 2 +- examples/test_event_firing.py | 4 +- examples/test_fail.py | 2 +- examples/test_geolocation.py | 6 +- examples/test_get_coffee.py | 2 +- examples/test_get_locale_code.py | 2 +- examples/test_get_pdf_text.py | 2 +- examples/test_get_swag.py | 2 +- examples/test_get_user_agent.py | 2 +- examples/test_hack_search.py | 4 +- examples/test_highlight_elements.py | 2 +- examples/test_image_saving.py | 8 +- examples/test_inspect_html.py | 2 +- examples/test_login.py | 12 +-- examples/test_markers.py | 8 +- examples/test_mfa_login.py | 2 +- examples/test_multiple_drivers.py | 6 +- examples/test_override_driver.py | 2 +- examples/test_override_sb_fixture.py | 4 +- examples/test_parse_soup.py | 4 +- examples/test_pdf_asserts.py | 2 +- examples/test_pytest_parametrize.py | 4 +- examples/test_repeat_tests.py | 6 +- examples/test_request_sb_fixture.py | 4 +- examples/test_roblox_mobile.py | 4 +- examples/test_save_screenshots.py | 10 +-- examples/test_sb_fixture.py | 4 +- examples/test_scrape_bing.py | 4 +- examples/test_select_options.py | 2 +- examples/test_shadow_dom.py | 6 +- examples/test_show_file_choosers.py | 2 +- examples/test_simple_login.py | 2 +- examples/test_suite.py | 10 +-- examples/test_swag_labs.py | 2 +- examples/test_tinymce.py | 4 +- examples/test_todomvc.py | 2 +- examples/test_url_asserts.py | 2 +- examples/test_usefixtures.py | 2 +- examples/test_verify_chromedriver.py | 2 +- examples/test_window_switching.py | 6 +- examples/test_xfail.py | 2 +- examples/test_xkcd.py | 2 +- examples/time_limit_test.py | 4 +- examples/tour_examples/ReadMe.md | 4 +- .../tour_examples/bootstrap_google_tour.py | 4 +- examples/tour_examples/bootstrap_xkcd_tour.py | 2 +- examples/tour_examples/driverjs_maps_tour.py | 2 +- examples/tour_examples/google_tour.py | 4 +- .../tour_examples/hopscotch_google_tour.py | 4 +- examples/tour_examples/introjs_google_tour.py | 4 +- examples/tour_examples/maps_introjs_tour.py | 2 +- examples/tour_examples/octocat_tour.py | 2 +- .../tour_examples/shepherd_google_tour.py | 4 +- examples/tour_examples/xkcd_tour.py | 2 +- examples/translations/chinese_test_1.py | 2 +- examples/translations/dutch_test_1.py | 2 +- examples/translations/english_test_1.py | 2 +- examples/translations/french_test_1.py | 2 +- examples/translations/italian_test_1.py | 2 +- examples/translations/japanese_test_1.py | 2 +- examples/translations/korean_test_1.py | 2 +- examples/translations/portuguese_test_1.py | 2 +- examples/translations/russian_test_1.py | 2 +- examples/translations/spanish_test_1.py | 2 +- examples/unit_tests/verify_framework.py | 6 +- examples/upload_file_test.py | 2 +- examples/user_agent_test.py | 6 +- examples/verify_undetected.py | 2 +- examples/visual_testing/ReadMe.md | 6 +- examples/visual_testing/layout_test.py | 4 +- examples/visual_testing/python_home_test.py | 2 +- examples/visual_testing/test_layout_fail.py | 4 +- examples/visual_testing/xkcd_visual_test.py | 2 +- examples/wordle_test.py | 4 +- examples/xpath_test.py | 2 +- examples/youtube_search_test.py | 4 +- help_docs/cdp_mode_methods.md | 8 +- help_docs/customizing_test_runs.md | 2 +- help_docs/how_it_works.md | 6 +- help_docs/html_inspector.md | 4 +- help_docs/js_package_manager.md | 2 +- help_docs/method_summary.md | 16 ++-- help_docs/mobile_testing.md | 2 +- help_docs/recorder_mode.md | 4 +- help_docs/syntax_formats.md | 46 +++++------ integrations/behave/ReadMe.md | 2 +- .../behave/features/steps/calculator.py | 2 +- .../behave/features/steps/fail_page.py | 2 +- .../behave/features/steps/real_world.py | 2 +- .../behave/features/steps/swag_labs.py | 2 +- integrations/node_js/my_first_test.py | 2 +- integrations/node_js/test_demo_site.py | 2 +- sbase/steps.py | 2 +- seleniumbase/config/settings.py | 2 +- seleniumbase/console_scripts/run.py | 6 +- seleniumbase/console_scripts/sb_mkdir.py | 19 ++--- seleniumbase/console_scripts/sb_mkfile.py | 14 ++-- seleniumbase/core/recorder_helper.py | 12 +-- seleniumbase/core/sb_cdp.py | 2 +- seleniumbase/fixtures/base_case.py | 78 ++++++++++-------- seleniumbase/masterqa/ReadMe.md | 6 +- seleniumbase/plugins/pytest_plugin.py | 2 +- seleniumbase/plugins/selenium_plugin.py | 2 +- seleniumbase/translate/master_dict.py | 81 +++++++++++-------- seleniumbase/utilities/selenium_ide/ReadMe.md | 2 +- .../utilities/selenium_ide/convert_ide.py | 4 +- 273 files changed, 665 insertions(+), 636 deletions(-) diff --git a/README.md b/README.md index 0c63a72510c..4b8bd1fb31e 100755 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome() -sb.open("https://browserscan.net/bot-detection") +sb.goto("https://browserscan.net/bot-detection") sb.sleep(3) sb.quit() ``` @@ -105,7 +105,7 @@ with sync_playwright() as p: from seleniumbase import sb_cdp sb = sb_cdp.Chrome(locale="en", ad_block=True) -sb.open("https://browserscan.net/bot-detection") +sb.goto("https://browserscan.net/bot-detection") sb.flash("Test Results", duration=1.5, pause=0.5) sb.assert_element('strong:contains("Normal")') print("Bot Not Detected") @@ -242,7 +242,7 @@ BaseCase.main(__name__, __file__) # Call pytest class MyTestClass(BaseCase): def test_swag_labs(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -362,7 +362,7 @@ BaseCase.main(__name__, __file__) class TestSimpleLogin(BaseCase): def test_simple_login(self): - self.open("seleniumbase.io/simple/login") + self.goto("seleniumbase.io/simple/login") self.type("#username", "demo_user") self.type("#password", "secret_pass") self.click('a:contains("Sign in")') @@ -379,7 +379,7 @@ class TestSimpleLogin(BaseCase): from seleniumbase import SB with SB() as sb: - sb.open("seleniumbase.io/simple/login") + sb.goto("seleniumbase.io/simple/login") sb.type("#username", "demo_user") sb.type("#password", "secret_pass") sb.click('a:contains("Sign in")') @@ -397,7 +397,7 @@ from seleniumbase import Driver driver = Driver() try: - driver.open("seleniumbase.io/simple/login") + driver.goto("seleniumbase.io/simple/login") driver.type("#username", "demo_user") driver.type("#password", "secret_pass") driver.click('a:contains("Sign in")') @@ -549,7 +549,7 @@ BaseCase.main(__name__, __file__) class MyTestClass(BaseCase): def test_swag_labs(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -582,7 +582,8 @@ class MyTestClass(BaseCase):

Here are some common SeleniumBase methods:

```python -self.open(url) # Navigate the browser window to the URL. +self.goto(url) # Navigate the browser window to the URL. +self.open(url) # Same as `self.goto(url)` self.activate_cdp_mode() # Activate CDP Mode from UC Mode. self.type(selector, text) # Update the field with the text. self.click(selector) # Click the element with the selector. @@ -958,7 +959,7 @@ BaseCase.main(__name__, __file__) class MyTestClass(BaseCase): def test_find_army_of_robots_on_xkcd_desert_island(self): - self.open("https://xkcd.com/731/") + self.goto("https://xkcd.com/731/") self.assert_element("div#ARMY_OF_ROBOTS", timeout=1) # This should fail ``` @@ -1162,7 +1163,7 @@ pytest [YOUR_TEST_FILE.py] --with-db-reporting --with-s3-logging 🔵 **Navigating to a web page: (and related commands)** ```python -self.open("https://xkcd.com/378/") # This method opens the specified page. +self.goto("https://xkcd.com/378/") # This method opens the specified page. self.go_back() # This method navigates the browser to the previous page. @@ -1299,7 +1300,7 @@ def is_there_a_cloaked_klingon_ship_on_this_page(): ```python if self.is_text_visible("You Shall Not Pass!", "h1"): - self.open("https://www.youtube.com/watch?v=3xYXUeSmb-Y") + self.goto("https://www.youtube.com/watch?v=3xYXUeSmb-Y") ```
@@ -1444,7 +1445,7 @@ self.execute_script("return jQuery('textarea')[2].value") # Returns the css "va ```python start_page = "https://xkcd.com/465/" destination_page = "https://github.com/seleniumbase/SeleniumBase" -self.open(start_page) +self.goto(start_page) referral_link = '''Free-Referral Button!''' % destination_page self.execute_script('''document.body.innerHTML = \"%s\"''' % referral_link) self.click("a.analytics") # Clicks the generated button @@ -1464,7 +1465,7 @@ BaseCase.main(__name__, __file__) class DeferredAssertTests(BaseCase): def test_deferred_asserts(self): - self.open("https://xkcd.com/993/") + self.goto("https://xkcd.com/993/") self.wait_for_element("#comic") self.deferred_assert_element('img[alt="Brand Identity"]') self.deferred_assert_element('img[alt="Rocket Ship"]') # Will Fail diff --git a/examples/basic_test.py b/examples/basic_test.py index 1751ec6dbc7..28a1587aaf4 100644 --- a/examples/basic_test.py +++ b/examples/basic_test.py @@ -5,7 +5,7 @@ class MyTestClass(BaseCase): def test_basics(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/behave_bdd/ReadMe.md b/examples/behave_bdd/ReadMe.md index 788b7c9b59d..a3e840b3a63 100644 --- a/examples/behave_bdd/ReadMe.md +++ b/examples/behave_bdd/ReadMe.md @@ -121,7 +121,7 @@ from behave import step @step("Open the Swag Labs Login Page") def go_to_swag_labs(context): sb = context.sb - sb.open("https://www.saucedemo.com") + sb.goto("https://www.saucedemo.com") sb.clear_local_storage() diff --git a/examples/behave_bdd/features/steps/calculator.py b/examples/behave_bdd/features/steps/calculator.py index 885b3f8922e..cd0926c58ea 100644 --- a/examples/behave_bdd/features/steps/calculator.py +++ b/examples/behave_bdd/features/steps/calculator.py @@ -3,7 +3,7 @@ @step("Open the Calculator App") def go_to_calculator(context): - context.sb.open("https://seleniumbase.io/apps/calculator") + context.sb.goto("https://seleniumbase.io/apps/calculator") @step("Press C") diff --git a/examples/behave_bdd/features/steps/fail_page.py b/examples/behave_bdd/features/steps/fail_page.py index 2525a61a332..3761c50a07e 100644 --- a/examples/behave_bdd/features/steps/fail_page.py +++ b/examples/behave_bdd/features/steps/fail_page.py @@ -3,7 +3,7 @@ @step("Open the Fail Page") def go_to_error_page(context): - context.sb.open("https://seleniumbase.io/error_page/") + context.sb.goto("https://seleniumbase.io/error_page/") @step("Fail test on purpose") diff --git a/examples/behave_bdd/features/steps/swag_labs.py b/examples/behave_bdd/features/steps/swag_labs.py index fb3052c6407..0ccbca3b639 100644 --- a/examples/behave_bdd/features/steps/swag_labs.py +++ b/examples/behave_bdd/features/steps/swag_labs.py @@ -4,7 +4,7 @@ @step("Open the Swag Labs Login Page") def go_to_swag_labs(context): sb = context.sb - sb.open("https://www.saucedemo.com") + sb.goto("https://www.saucedemo.com") sb.clear_local_storage() diff --git a/examples/boilerplates/classic_obj_test.py b/examples/boilerplates/classic_obj_test.py index 3b5baab9cd9..4055d61fc9e 100644 --- a/examples/boilerplates/classic_obj_test.py +++ b/examples/boilerplates/classic_obj_test.py @@ -5,7 +5,7 @@ class DataPage: def go_to_data_url(self, sb): - sb.open("data:text/html,

Hello!

") + sb.goto("data:text/html,

Hello!

") def add_input_text(self, sb, text): sb.type("input", text) diff --git a/examples/boilerplates/samples/google_test.py b/examples/boilerplates/samples/google_test.py index d0f67908770..06c569433cd 100644 --- a/examples/boilerplates/samples/google_test.py +++ b/examples/boilerplates/samples/google_test.py @@ -10,18 +10,19 @@ class GoogleTests(BaseCase): def test_google_dot_com(self): if self.headless: - self.open_if_not_url("about:blank") + self.goto_if_not_url("about:blank") print("\n Skipping test in headless mode.") self.skip("Skipping test in headless mode.") if not self.undetectable: self.get_new_driver(undetectable=True) - self.driver.get("https://google.com/ncr") + self.goto("https://google.com/ncr") self.click_if_visible('button:contains("Accept all")') self.assert_title_contains("Google") self.sleep(0.05) self.save_screenshot_to_logs() # ("./latest_logs" folder) - self.type(HomePage.search_box, "github.com") + self.type(HomePage.search_box, "GitHub") self.assert_element(HomePage.search_button) self.assert_element(HomePage.feeling_lucky_button) self.click(HomePage.search_button) + self.sleep(1) self.assert_text("github.com", ResultsPage.search_results) diff --git a/examples/boilerplates/samples/sb_swag_test.py b/examples/boilerplates/samples/sb_swag_test.py index 5756ba42f03..fed92469145 100644 --- a/examples/boilerplates/samples/sb_swag_test.py +++ b/examples/boilerplates/samples/sb_swag_test.py @@ -5,7 +5,7 @@ class LoginPage: def login_to_swag_labs(self, sb: BaseCase, username): - sb.open("https://www.saucedemo.com") + sb.goto("https://www.saucedemo.com") sb.type("#user-name", username) sb.type("#password", "secret_sauce") sb.click('input[type="submit"]') diff --git a/examples/boilerplates/samples/swag_labs_test.py b/examples/boilerplates/samples/swag_labs_test.py index 57e226b1014..002f1b55258 100644 --- a/examples/boilerplates/samples/swag_labs_test.py +++ b/examples/boilerplates/samples/swag_labs_test.py @@ -5,7 +5,7 @@ class LoginPage: def login_to_swag_labs(self, sb: BaseCase, username): - sb.open("https://www.saucedemo.com") + sb.goto("https://www.saucedemo.com") sb.type("#user-name", username) sb.type("#password", "secret_sauce") sb.click('input[type="submit"]') diff --git a/examples/boilerplates/samples/test_page_objects.py b/examples/boilerplates/samples/test_page_objects.py index 787579a6f90..4f3b1a9a4a4 100644 --- a/examples/boilerplates/samples/test_page_objects.py +++ b/examples/boilerplates/samples/test_page_objects.py @@ -5,7 +5,7 @@ class GooglePage: def go_to_google(self, sb): - sb.driver.get("https://google.com/ncr") + sb.goto("https://google.com/ncr") sb.click_if_visible('button:contains("Accept all")') def assert_google_title(self, sb): @@ -19,8 +19,8 @@ def hide_sign_in_pop_up(self, sb): def do_search(self, sb, search_term): sb.sleep(0.05) - sb.click('[title="Search"]') - sb.type('[title="Search"]', search_term + "\n") + sb.type('[name="q"]', search_term) + sb.click('[value="Google Search"]') def click_search_result(self, sb, content): sb.click('a:contains("%s")' % content) @@ -36,12 +36,12 @@ def do_search_and_click(self, sb, search_term): class MyTests(BaseCase): def test_page_objects(self): if self.headless: - self.open_if_not_url("about:blank") + self.goto_if_not_url("about:blank") print("\n Skipping test in headless mode.") self.skip("Skipping test in headless mode.") if not self.undetectable: self.get_new_driver(undetectable=True) - search_term = "SeleniumBase.io Docs" + search_term = "site:seleniumbase.io Docs" expected_text = "SeleniumBase" GooglePage().go_to_google(self) GooglePage().assert_google_title(self) diff --git a/examples/boilerplates/sb_fixture_test.py b/examples/boilerplates/sb_fixture_test.py index 40ea2bf2f1d..847735fcc28 100644 --- a/examples/boilerplates/sb_fixture_test.py +++ b/examples/boilerplates/sb_fixture_test.py @@ -3,7 +3,7 @@ class DataPage: def go_to_data_url(self, sb): - sb.open("data:text/html,

Hello!

") + sb.goto("data:text/html,

Hello!

") def add_input_text(self, sb, text): sb.type("input", text) diff --git a/examples/cdp_mode/ReadMe.md b/examples/cdp_mode/ReadMe.md index aa168cbca3e..573aa04372a 100644 --- a/examples/cdp_mode/ReadMe.md +++ b/examples/cdp_mode/ReadMe.md @@ -41,7 +41,7 @@ That disconnects WebDriver from Chrome (which prevents detection), and gives you access to `sb.cdp` methods (which don't trigger anti-bot checks). -> (**New:** Calling **`sb.open(url)`** from UC Mode also activates CDP Mode now.) +> (**New:** Calling **`sb.goto(url)`** from UC Mode also activates CDP Mode now.) Simple example from [SeleniumBase/examples/cdp_mode/raw_gitlab.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/raw_gitlab.py): @@ -163,7 +163,7 @@ with SB(uc=True, test=True, locale="en", ad_block=True) as sb: sb.sleep(2) sb.highlight_overlay("div.pokemon-ability-info") sb.sleep(2) - sb.open("https://events.pokemon.com/EventLocator/") + sb.goto("https://events.pokemon.com/EventLocator/") sb.sleep(2) sb.click('span:contains("Championship")') sb.sleep(2) @@ -372,6 +372,7 @@ with SB(uc=True, test=True, locale="en", pls="none") as sb: ```python sb.cdp.get(url, **kwargs) +sb.cdp.goto(url, **kwargs) # Same as sb.cdp.get(url, **kwargs) sb.cdp.open(url, **kwargs) # Same as sb.cdp.get(url, **kwargs) sb.cdp.reload(ignore_cache=True, script_to_evaluate_on_load=None) sb.cdp.refresh(*args, **kwargs) @@ -582,7 +583,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome(url) ``` -Pure CDP Mode includes all methods from regular CDP Mode, except that they're called directly from sb instead of sb.cdp. Eg: sb.gui_click_captcha(). To quit a CDP-launched browser, use `sb.driver.stop()`. +Pure CDP Mode includes all methods from regular CDP Mode, except that they're called directly from sb instead of sb.cdp. Eg: sb.gui_click_captcha(). To quit a CDP-launched browser, use `sb.quit()`. Basic example from [SeleniumBase/examples/cdp_mode/raw_cdp_turnstile.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/raw_cdp_turnstile.py): @@ -595,7 +596,7 @@ sb.solve_captcha() sb.assert_element("img#captcha-success") sb.set_messenger_theme(location="top_left") sb.post_message("SeleniumBase wasn't detected", duration=3) -sb.driver.stop() +sb.quit() ``` Another example: ([SeleniumBase/examples/cdp_mode/raw_cdp_methods.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/raw_cdp_methods.py)) @@ -617,10 +618,10 @@ sb.gui_click_element("#checkBox1") sb.gui_drag_and_drop("img#logo", "div#drop2") sb.nested_click("iframe#myFrame3", ".fBox") sb.sleep(2) -sb.driver.stop() +sb.quit() ``` -ℹ️ Even if you don't call `sb.driver.stop()`, the browser still quits after the script goes out-of-scope. +ℹ️ Even if you don't call `sb.quit()`, the browser still quits after the script goes out-of-scope. ---- @@ -639,7 +640,8 @@ Methods: (Sometimes `tab` is named `page` in examples) ```python await tab.get(url="about:blank") -await tab.open(url="about:blank") +await tab.goto(url="about:blank") # Same as await tab.get(url) +await tab.open(url="about:blank") # Same as await tab.get(url) await tab.find(text, best_match=False, timeout=10) # text can be selector await tab.find_all(text, timeout=10) # text can be selector await tab.select(selector, timeout=10) diff --git a/examples/cdp_mode/playwright/ReadMe.md b/examples/cdp_mode/playwright/ReadMe.md index 8038a3a236f..94bba582b5e 100644 --- a/examples/cdp_mode/playwright/ReadMe.md +++ b/examples/cdp_mode/playwright/ReadMe.md @@ -215,15 +215,17 @@ To use an authenticated proxy in Stealthy Playwright Mode, **do these two things ⚠️ If any trouble with the above, set `use_chromium=True` so that you can use the base Chromium browser, which still allows extensions, unlike regular branded Chrome, which removed the `--load-extension` command-line switch. (*An extension is used to set the auth for the proxy, which is needed when CDP can't set the proxy alone, such as for navigation after the initial page load*). -In the sync format, use `sb.open(url)` to open the url before connecting Playwright: +In the sync format, use `sb.goto(url)` to open the url before connecting Playwright: + ```python sb = sb_cdp.Chrome(use_chromium=True, proxy="user:pass@server:port") -sb.open(url) +sb.goto(url) endpoint_url = sb.get_endpoint_url() # ... ``` In the async format, use, `driver.get(url)` to open the url before connecting Playwright: + ```python driver = await cdp_driver.start_async(use_chromium=True, proxy="user:pass@server:port") await driver.get(url) @@ -232,12 +234,13 @@ endpoint_url = driver.get_endpoint_url() ``` Here's an example of using an authenticated proxy with Stealthy Playwright Mode:
(The URL is opened before attaching Playwright so that proxy settings take effect) + ```python from playwright.sync_api import sync_playwright from seleniumbase import sb_cdp sb = sb_cdp.Chrome(use_chromium=True, proxy="user:pass@server:port") -sb.open(url) +sb.goto(url) endpoint_url = sb.get_endpoint_url() with sync_playwright() as p: @@ -245,9 +248,11 @@ with sync_playwright() as p: page = browser.contexts[0].pages[0] # ... ``` + (Fill in the `url` and the `proxy` details to complete the script.) Here's the same thing for the `async` format: + ```python import asyncio from playwright.async_api import async_playwright @@ -267,6 +272,7 @@ if __name__ == "__main__": loop = asyncio.new_event_loop() loop.run_until_complete(main()) ``` + (Fill in the `url` and the `proxy` details to complete the script.) -------- diff --git a/examples/cdp_mode/playwright/raw_indeed_sync.py b/examples/cdp_mode/playwright/raw_indeed_sync.py index dfdf47f4acf..87c1d0ccf9f 100644 --- a/examples/cdp_mode/playwright/raw_indeed_sync.py +++ b/examples/cdp_mode/playwright/raw_indeed_sync.py @@ -2,7 +2,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome() -sb.open("https://www.indeed.com/companies/search") +sb.goto("https://www.indeed.com/companies/search") sb.sleep(2) sb.solve_captcha() sb.sleep(1) diff --git a/examples/cdp_mode/playwright/raw_walmart_sync.py b/examples/cdp_mode/playwright/raw_walmart_sync.py index c628359c57d..02916fe794a 100644 --- a/examples/cdp_mode/playwright/raw_walmart_sync.py +++ b/examples/cdp_mode/playwright/raw_walmart_sync.py @@ -2,7 +2,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome(locale="en", guest=True) -sb.open("https://www.walmart.com/") +sb.goto("https://www.walmart.com/") endpoint_url = sb.get_endpoint_url() with sync_playwright() as p: diff --git a/examples/cdp_mode/raw_ad_blocking.py b/examples/cdp_mode/raw_ad_blocking.py index 5567d3a6367..47b6512ff73 100644 --- a/examples/cdp_mode/raw_ad_blocking.py +++ b/examples/cdp_mode/raw_ad_blocking.py @@ -25,7 +25,7 @@ async def block_urls(tab): sb = sb_cdp.Chrome() loop = sb.get_event_loop() loop.run_until_complete(block_urls(sb.get_active_tab())) - sb.open("https://www.w3schools.com/jquery/default.asp") + sb.goto("https://www.w3schools.com/jquery/default.asp") source = sb.get_page_source() sb.assert_false("doubleclick.net" in source) sb.assert_false("google-analytics.com" in source) diff --git a/examples/cdp_mode/raw_async.py b/examples/cdp_mode/raw_async.py index 0b42701b86d..c5040b30ce0 100644 --- a/examples/cdp_mode/raw_async.py +++ b/examples/cdp_mode/raw_async.py @@ -20,7 +20,7 @@ async def main(): links = await top_nav.query_selector_all_async("a") for nav_item in links: print(nav_item.text) - driver.stop() + driver.quit() if __name__ == "__main__": # Call an async function with awaited methods diff --git a/examples/cdp_mode/raw_basic_async.py b/examples/cdp_mode/raw_basic_async.py index bbba2e8d26a..5c497a469ba 100644 --- a/examples/cdp_mode/raw_basic_async.py +++ b/examples/cdp_mode/raw_basic_async.py @@ -18,7 +18,7 @@ async def main(): links = await top_nav.query_selector_all_async("a") for nav_item in links: print(nav_item.text) - driver.stop() + driver.quit() if __name__ == "__main__": loop = asyncio.new_event_loop() diff --git a/examples/cdp_mode/raw_basic_cdp.py b/examples/cdp_mode/raw_basic_cdp.py index dddcb0af6b9..fc1cd118697 100644 --- a/examples/cdp_mode/raw_basic_cdp.py +++ b/examples/cdp_mode/raw_basic_cdp.py @@ -1,7 +1,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome() -sb.open("https://seleniumbase.io/simple/login") +sb.goto("https://seleniumbase.io/simple/login") sb.type("#username", "demo_user") sb.type("#password", "secret_pass") sb.click('a:contains("Sign in")') diff --git a/examples/cdp_mode/raw_browserscan.py b/examples/cdp_mode/raw_browserscan.py index c84012caf18..26835b5b043 100644 --- a/examples/cdp_mode/raw_browserscan.py +++ b/examples/cdp_mode/raw_browserscan.py @@ -2,7 +2,7 @@ with SB(uc=True, test=True, locale="en", ad_block=True) as sb: sb.activate_cdp_mode() - sb.open("https://browserscan.net/bot-detection") + sb.goto("https://browserscan.net/bot-detection") sb.flash("Test Results", duration=1.5, pause=0.5) sb.assert_element('strong:contains("Normal")') print("Bot Not Detected") diff --git a/examples/cdp_mode/raw_cdp_browserscan.py b/examples/cdp_mode/raw_cdp_browserscan.py index 223db2ccfb2..b25d44fc528 100644 --- a/examples/cdp_mode/raw_cdp_browserscan.py +++ b/examples/cdp_mode/raw_cdp_browserscan.py @@ -1,7 +1,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome(locale="en", ad_block=True) -sb.open("https://browserscan.net/bot-detection") +sb.goto("https://browserscan.net/bot-detection") sb.flash("Test Results", duration=1.5, pause=0.5) sb.assert_element('strong:contains("Normal")') print("Bot Not Detected") diff --git a/examples/cdp_mode/raw_cdp_copilot.py b/examples/cdp_mode/raw_cdp_copilot.py index 14284d7deb5..06096b26020 100644 --- a/examples/cdp_mode/raw_cdp_copilot.py +++ b/examples/cdp_mode/raw_cdp_copilot.py @@ -41,4 +41,4 @@ file_name = "copilot_results.html" sb.save_as_html(file_name, folder) print('"./%s/%s" was saved!' % (folder, file_name)) -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_extended.py b/examples/cdp_mode/raw_cdp_extended.py index e696cb39bee..e3073892da3 100644 --- a/examples/cdp_mode/raw_cdp_extended.py +++ b/examples/cdp_mode/raw_cdp_extended.py @@ -21,4 +21,4 @@ sb.gui_drag_and_drop("img#logo", "div#drop2") sb.nested_click("iframe#myFrame3", ".fBox") sb.sleep(2) -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_fingerprint.py b/examples/cdp_mode/raw_cdp_fingerprint.py index 8e36d99e38f..06e61c9734e 100644 --- a/examples/cdp_mode/raw_cdp_fingerprint.py +++ b/examples/cdp_mode/raw_cdp_fingerprint.py @@ -1,7 +1,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome() -sb.open("https://demo.fingerprint.com/playground") +sb.goto("https://demo.fingerprint.com/playground") sb.wait_for_element('a[href*="browser-bot-detection"]') sb.flash('a[href*="browser-bot-detection"]', duration=3, pause=1) bot_row_selector = 'table:contains("Bot") tr:nth-of-type(3)' diff --git a/examples/cdp_mode/raw_cdp_gitlab.py b/examples/cdp_mode/raw_cdp_gitlab.py index d285fe253b3..1df993e619c 100644 --- a/examples/cdp_mode/raw_cdp_gitlab.py +++ b/examples/cdp_mode/raw_cdp_gitlab.py @@ -6,4 +6,4 @@ sb.solve_captcha() sb.highlight('h1:contains("GitLab")') sb.highlight('button:contains("Sign in")') -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_hyatt.py b/examples/cdp_mode/raw_cdp_hyatt.py index 0d719d4feea..085d4050e8b 100644 --- a/examples/cdp_mode/raw_cdp_hyatt.py +++ b/examples/cdp_mode/raw_cdp_hyatt.py @@ -33,4 +33,4 @@ if "Rates from : " in info: price = info.split("Rates from : ")[1].split(" Avg/Night")[0] print("* %s => %s" % (name, price)) -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_login.py b/examples/cdp_mode/raw_cdp_login.py index 062a994defc..793eb64afb1 100644 --- a/examples/cdp_mode/raw_cdp_login.py +++ b/examples/cdp_mode/raw_cdp_login.py @@ -17,7 +17,7 @@ def main(): print(nav_item.text) sb.click_link("Sign out") sb.assert_text("signed out", "#top_message") - sb.driver.stop() + sb.quit() if __name__ == "__main__": diff --git a/examples/cdp_mode/raw_cdp_methods.py b/examples/cdp_mode/raw_cdp_methods.py index a503edaebd9..34872606b7a 100644 --- a/examples/cdp_mode/raw_cdp_methods.py +++ b/examples/cdp_mode/raw_cdp_methods.py @@ -14,4 +14,4 @@ sb.gui_drag_and_drop("img#logo", "div#drop2") sb.nested_click("iframe#myFrame3", ".fBox") sb.sleep(2) -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_mobile.py b/examples/cdp_mode/raw_cdp_mobile.py index 6e669987674..55dd2ff49c5 100644 --- a/examples/cdp_mode/raw_cdp_mobile.py +++ b/examples/cdp_mode/raw_cdp_mobile.py @@ -12,7 +12,7 @@ ) ) url = "https://gitlab.com/users/sign_in" -sb.open(url) +sb.goto(url) sb.sleep(2) sb.solve_captcha() # (The rest is for testing and demo purposes) diff --git a/examples/cdp_mode/raw_cdp_nike.py b/examples/cdp_mode/raw_cdp_nike.py index 2bdb3ec9739..3470f78b980 100644 --- a/examples/cdp_mode/raw_cdp_nike.py +++ b/examples/cdp_mode/raw_cdp_nike.py @@ -14,4 +14,4 @@ print('**** Found results for "%s": ****' % search) for element in elements: print("* " + element.text) -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_nordstrom.py b/examples/cdp_mode/raw_cdp_nordstrom.py index 4b9257d8e1f..b42b7f87eed 100644 --- a/examples/cdp_mode/raw_cdp_nordstrom.py +++ b/examples/cdp_mode/raw_cdp_nordstrom.py @@ -23,4 +23,4 @@ if price: price_text = price.text print("* %s (%s)" % (description.text, price_text)) -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_pixelscan.py b/examples/cdp_mode/raw_cdp_pixelscan.py index 945cc6ad75e..b85d1c316cc 100644 --- a/examples/cdp_mode/raw_cdp_pixelscan.py +++ b/examples/cdp_mode/raw_cdp_pixelscan.py @@ -1,7 +1,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome(guest=True, ad_block=True) -sb.open("https://pixelscan.net/fingerprint-check") +sb.goto("https://pixelscan.net/fingerprint-check") sb.sleep(1) sb.wait_for_element("pxlscn-dynamic-ad") sb.sleep(0.5) diff --git a/examples/cdp_mode/raw_cdp_recaptcha.py b/examples/cdp_mode/raw_cdp_recaptcha.py index 82c75835a02..6ba402c4978 100644 --- a/examples/cdp_mode/raw_cdp_recaptcha.py +++ b/examples/cdp_mode/raw_cdp_recaptcha.py @@ -6,4 +6,4 @@ sb.assert_element("img#captcha-success") sb.set_messenger_theme(location="top_left") sb.post_message("SeleniumBase wasn't detected", duration=3) -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_sannysoft.py b/examples/cdp_mode/raw_cdp_sannysoft.py index c88635f6d22..ff0de4ab2bf 100644 --- a/examples/cdp_mode/raw_cdp_sannysoft.py +++ b/examples/cdp_mode/raw_cdp_sannysoft.py @@ -1,7 +1,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome() -sb.open("https://bot.sannysoft.com/") +sb.goto("https://bot.sannysoft.com/") sb.flash("#user-agent-result.passed") sb.flash("#webdriver-result.passed") sb.flash("#advanced-webdriver-result.passed") diff --git a/examples/cdp_mode/raw_cdp_tabs.py b/examples/cdp_mode/raw_cdp_tabs.py index 695658ffce0..9d5c2493741 100644 --- a/examples/cdp_mode/raw_cdp_tabs.py +++ b/examples/cdp_mode/raw_cdp_tabs.py @@ -1,10 +1,10 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome() -sb.open("data:text/html,

Page A

") +sb.goto("data:text/html,

Page A

") sb.assert_text("Page A") sb.open_new_tab() -sb.open("data:text/html,

Page B

") +sb.goto("data:text/html,

Page B

") sb.assert_text("Page B") sb.switch_to_tab(0) sb.assert_text("Page A") @@ -12,4 +12,4 @@ sb.switch_to_tab(1) sb.assert_text("Page B") sb.assert_text_not_visible("Page A") -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_tavus.py b/examples/cdp_mode/raw_cdp_tavus.py index c398391110f..e6f1c2c9ba7 100644 --- a/examples/cdp_mode/raw_cdp_tavus.py +++ b/examples/cdp_mode/raw_cdp_tavus.py @@ -1,7 +1,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome() -sb.open("platform.tavus.io/auth/sign-in?is_developer=true") +sb.goto("platform.tavus.io/auth/sign-in?is_developer=true") sb.sleep(3) sb.solve_captcha() sb.sleep(1) diff --git a/examples/cdp_mode/raw_cdp_timezone.py b/examples/cdp_mode/raw_cdp_timezone.py index ed02ee80c92..5843016a96f 100644 --- a/examples/cdp_mode/raw_cdp_timezone.py +++ b/examples/cdp_mode/raw_cdp_timezone.py @@ -2,13 +2,13 @@ sb = sb_cdp.Chrome(ad_block=True, incognito=True) url = "https://www.randymajors.org/what-time-zone-am-i-in" -sb.open(url, tzone="Asia/Kolkata", geoloc=(26.863, 80.94)) +sb.goto(url, tzone="Asia/Kolkata", geoloc=(26.863, 80.94)) sb.remove_elements("#right-sidebar") sb.sleep(2.5) sb.remove_elements('[data-google-query-id]') sb.remove_elements("iframe:not(#embedMapFrame)") sb.sleep(2.5) -sb.open(url, tzone="Asia/Tokyo", geoloc=(35.050681, 136.844728)) +sb.goto(url, tzone="Asia/Tokyo", geoloc=(35.050681, 136.844728)) sb.remove_elements("#right-sidebar") sb.sleep(2.5) sb.remove_elements('[data-google-query-id]') diff --git a/examples/cdp_mode/raw_cdp_turnstile.py b/examples/cdp_mode/raw_cdp_turnstile.py index aa8a1cdb53e..e46e23df26e 100644 --- a/examples/cdp_mode/raw_cdp_turnstile.py +++ b/examples/cdp_mode/raw_cdp_turnstile.py @@ -6,4 +6,4 @@ sb.assert_element("img#captcha-success") sb.set_messenger_theme(location="top_left") sb.post_message("SeleniumBase wasn't detected", duration=3) -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cdp_walmart.py b/examples/cdp_mode/raw_cdp_walmart.py index 73e49fab54c..6d8018d3fb3 100644 --- a/examples/cdp_mode/raw_cdp_walmart.py +++ b/examples/cdp_mode/raw_cdp_walmart.py @@ -44,4 +44,4 @@ price_text = price_text.split(" ")[0] print(" (" + price_text + ")") item.scroll_into_view() -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_cf_clearance.py b/examples/cdp_mode/raw_cf_clearance.py index b59524c21e7..cc77ff672d0 100644 --- a/examples/cdp_mode/raw_cf_clearance.py +++ b/examples/cdp_mode/raw_cf_clearance.py @@ -19,4 +19,4 @@ def get_cf_clearance_cookie(sb): print("cf_clearance cookie: %s" % cf_cookie.value) else: print("Didn't find the cf_clearance cookie!") -sb.driver.stop() +sb.quit() diff --git a/examples/cdp_mode/raw_consecutive_c.py b/examples/cdp_mode/raw_consecutive_c.py index 21302b6b20c..90df30c61bf 100644 --- a/examples/cdp_mode/raw_consecutive_c.py +++ b/examples/cdp_mode/raw_consecutive_c.py @@ -3,7 +3,7 @@ with SB(uc=True, test=True) as sb: sb.activate_cdp_mode() - sb.open("https://agents.moderationinterface.com") + sb.goto("https://agents.moderationinterface.com") sb.sleep(3) if not sb.is_element_present("#login-submit"): sb.solve_captcha() diff --git a/examples/cdp_mode/raw_demo_site.py b/examples/cdp_mode/raw_demo_site.py index 6b89dda245a..579e8ad032b 100644 --- a/examples/cdp_mode/raw_demo_site.py +++ b/examples/cdp_mode/raw_demo_site.py @@ -3,7 +3,7 @@ with SB(uc=True, test=True) as sb: sb.activate_cdp_mode() - sb.open("https://seleniumbase.io/demo_page") + sb.cdp.goto("https://seleniumbase.io/demo_page") # Assert various things sb.cdp.assert_title("Web Testing Page") diff --git a/examples/cdp_mode/raw_driver.py b/examples/cdp_mode/raw_driver.py index 87e359ba357..cf053c41eb0 100644 --- a/examples/cdp_mode/raw_driver.py +++ b/examples/cdp_mode/raw_driver.py @@ -3,9 +3,9 @@ driver = Driver(uc=True, guest=True) atexit.register(driver.quit) -url = "www.planetminecraft.com/account" -driver.activate_cdp_mode(url) -driver.sleep(2) +driver.activate_cdp_mode() +driver.open("www.planetminecraft.com/account") +driver.sleep(3) driver.solve_captcha() driver.wait_for_element_absent("input[disabled]") driver.sleep(2) diff --git a/examples/cdp_mode/raw_fingerprint.py b/examples/cdp_mode/raw_fingerprint.py index 16d54ca5cbd..9a7c4a2137c 100644 --- a/examples/cdp_mode/raw_fingerprint.py +++ b/examples/cdp_mode/raw_fingerprint.py @@ -2,7 +2,7 @@ with SB(uc=True, test=True) as sb: sb.activate_cdp_mode() - sb.open("https://demo.fingerprint.com/playground") + sb.goto("https://demo.fingerprint.com/playground") sb.flash('a[href*="browser-bot-detection"]', duration=3, pause=1) bot_row_selector = 'table:contains("Bot") tr:nth-of-type(3)' print(sb.get_text(bot_row_selector)) diff --git a/examples/cdp_mode/raw_geolocation.py b/examples/cdp_mode/raw_geolocation.py index b93fba68677..f4b11d42f35 100644 --- a/examples/cdp_mode/raw_geolocation.py +++ b/examples/cdp_mode/raw_geolocation.py @@ -12,7 +12,7 @@ def main(): sb.click('a[aria-label="Show My Location"]') sb.assert_url_contains("48.876450/2.263400") sb.sleep(5) - sb.driver.stop() + sb.quit() if __name__ == "__main__": diff --git a/examples/cdp_mode/raw_mfa_login.py b/examples/cdp_mode/raw_mfa_login.py index 66c9bce30e3..bbc183ef86e 100644 --- a/examples/cdp_mode/raw_mfa_login.py +++ b/examples/cdp_mode/raw_mfa_login.py @@ -1,7 +1,7 @@ from seleniumbase import sb_cdp sb = sb_cdp.Chrome() -sb.open("https://seleniumbase.io/realworld/login") +sb.goto("https://seleniumbase.io/realworld/login") sb.type("#username", "demo_user") sb.type("#password", "secret_pass") sb.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") diff --git a/examples/cdp_mode/raw_mobile_agents.py b/examples/cdp_mode/raw_mobile_agents.py index 24fde4f1b6a..6f8bee60619 100644 --- a/examples/cdp_mode/raw_mobile_agents.py +++ b/examples/cdp_mode/raw_mobile_agents.py @@ -11,10 +11,10 @@ with SB(uc=True, test=True, mobile=True) as sb: sb.set_window_position(20, 54) sb.activate_cdp_mode() - sb.open(url) + sb.goto(url) sb.sleep(2) sb.get_new_driver() sb.set_window_position(550, 54) sb.activate_cdp_mode(agent=agent) - sb.open(url) + sb.goto(url) sb.sleep(8) diff --git a/examples/cdp_mode/raw_mobile_gitlab.py b/examples/cdp_mode/raw_mobile_gitlab.py index b9853c39161..aadd7a03b98 100644 --- a/examples/cdp_mode/raw_mobile_gitlab.py +++ b/examples/cdp_mode/raw_mobile_gitlab.py @@ -13,7 +13,7 @@ ) ) ) - sb.open(url) + sb.goto(url) sb.sleep(2) sb.solve_captcha() # (The rest is for testing and demo purposes) diff --git a/examples/cdp_mode/raw_mobile_roblox.py b/examples/cdp_mode/raw_mobile_roblox.py index aaeb5e0b363..e9eaa4b4365 100644 --- a/examples/cdp_mode/raw_mobile_roblox.py +++ b/examples/cdp_mode/raw_mobile_roblox.py @@ -19,7 +19,7 @@ ) ) ) - sb.open(url) + sb.goto(url) sb.assert_element("#download-the-app-container") sb.assert_text("Roblox for Android") sb.highlight('span:contains("Roblox for Android")', loops=8) diff --git a/examples/cdp_mode/raw_multi_captcha.py b/examples/cdp_mode/raw_multi_captcha.py index a05905128e0..8bea3b8b226 100644 --- a/examples/cdp_mode/raw_multi_captcha.py +++ b/examples/cdp_mode/raw_multi_captcha.py @@ -14,7 +14,7 @@ def main(url): if not sb.is_element_visible("img#captcha-success"): sb.solve_captcha() sb.sleep(2.2) - sb.driver.stop() + sb.quit() if __name__ == "__main__": diff --git a/examples/cdp_mode/raw_planetmc.py b/examples/cdp_mode/raw_planetmc.py index 09ee37d7998..f37c97419f9 100644 --- a/examples/cdp_mode/raw_planetmc.py +++ b/examples/cdp_mode/raw_planetmc.py @@ -1,8 +1,8 @@ from seleniumbase import SB with SB(uc=True, test=True, guest=True) as sb: - url = "www.planetminecraft.com/account/sign_in/" - sb.activate_cdp_mode(url) + sb.activate_cdp_mode() + sb.goto("www.planetminecraft.com/account/sign_in/") sb.sleep(3) sb.solve_captcha() sb.wait_for_element_absent("input[disabled]") diff --git a/examples/cdp_mode/raw_pokemon.py b/examples/cdp_mode/raw_pokemon.py index 5a1c6ba1315..da78b82b245 100644 --- a/examples/cdp_mode/raw_pokemon.py +++ b/examples/cdp_mode/raw_pokemon.py @@ -30,7 +30,7 @@ sb.sleep(2) sb.highlight_overlay("div.pokemon-ability-info") sb.sleep(2) - sb.open("https://events.pokemon.com/EventLocator/") + sb.goto("https://events.pokemon.com/EventLocator/") sb.sleep(2) sb.click('span:contains("Championship")') sb.sleep(2) diff --git a/examples/cdp_mode/raw_proxy.py b/examples/cdp_mode/raw_proxy.py index ce403806d88..c5d4233a29f 100644 --- a/examples/cdp_mode/raw_proxy.py +++ b/examples/cdp_mode/raw_proxy.py @@ -13,21 +13,21 @@ def main(): if "ERR" in ip_address: raise Exception("Failed to determine IP Address!") print("\n\nMy IP Address = %s\n" % ip_address) - sb.open("https://ipinfo.io/%s" % ip_address) + sb.goto("https://ipinfo.io/%s" % ip_address) sb.sleep(2) sb.wait_for_text(ip_address, "h1", timeout=20) - sb.find_element('[href="/signup"]') + sb.wait_for_element('[href="/signup"]') sb.wait_for_text("Hosted domains", timeout=20) sb.highlight("h1") pop_up = '[role="dialog"] span.cursor-pointer' sb.click_if_visible(pop_up) - sb.highlight("#block-summary") + sb.highlight("section#summary") sb.click_if_visible(pop_up) - sb.highlight("#block-geolocation") + sb.highlight("section#geolocation") sb.click_if_visible(pop_up) sb.sleep(2) print("Displaying Host Info:") - text = sb.get_text("#block-summary").split("Hosted domains")[0] + text = sb.get_text("#summary").split("Hosted domains")[0] rows = text.split("\n") data = [] for row in rows: @@ -35,7 +35,7 @@ def main(): data.append(row.strip()) print("\n".join(data).replace('\n"', ' "')) print("\nDisplaying GeoLocation Info:") - text = sb.get_text("#block-geolocation") + text = sb.get_text("#geolocation") text = text.split("IP Geolocation data")[0] rows = text.split("\n") data = [] @@ -45,7 +45,7 @@ def main(): print("\n".join(data).replace('\n"', ' "')) sb.click_if_visible(pop_up) sb.sleep(3) - sb.driver.stop() + sb.quit() if __name__ == "__main__": diff --git a/examples/cdp_mode/raw_req_mod.py b/examples/cdp_mode/raw_req_mod.py index cc4bb0bdf6e..f59ea6e4ab3 100644 --- a/examples/cdp_mode/raw_req_mod.py +++ b/examples/cdp_mode/raw_req_mod.py @@ -17,7 +17,7 @@ async def request_paused_handler(event, tab): with SB(uc=True, test=True, locale="en", pls="none") as sb: sb.activate_cdp_mode("about:blank") sb.add_handler(mycdp.fetch.RequestPaused, request_paused_handler) - sb.open("https://gettyimages.com/photos/jonathan-frakes-cast-2022") + sb.goto("https://gettyimages.com/photos/jonathan-frakes-cast-2022") new_size = "--width:100;--height:100;" sb.set_attributes('[style*="--width:"]', "style", new_size) sb.sleep(6) diff --git a/examples/cdp_mode/raw_req_sb.py b/examples/cdp_mode/raw_req_sb.py index a8e2b30f1cd..121ffd3f2a1 100644 --- a/examples/cdp_mode/raw_req_sb.py +++ b/examples/cdp_mode/raw_req_sb.py @@ -27,5 +27,5 @@ async def request_paused_handler(event, tab): sb.activate_cdp_mode("about:blank") sb.add_handler(mycdp.fetch.RequestPaused, request_paused_handler) url = "https://gettyimages.com/photos/firefly-2003-nathan" - sb.open(url) + sb.goto(url) sb.sleep(4) diff --git a/examples/cdp_mode/raw_res_sb.py b/examples/cdp_mode/raw_res_sb.py index da2e29f67b0..0459c6f0f67 100644 --- a/examples/cdp_mode/raw_res_sb.py +++ b/examples/cdp_mode/raw_res_sb.py @@ -30,5 +30,5 @@ async def receive_handler(event: mycdp.network.ResponseReceived): sb.add_handler(mycdp.network.RequestWillBeSent, send_handler) sb.add_handler(mycdp.network.ResponseReceived, receive_handler) url = "https://seleniumbase.io/apps/calculator" - sb.open(url) + sb.goto(url) sb.sleep(1) diff --git a/examples/cdp_mode/raw_sannysoft.py b/examples/cdp_mode/raw_sannysoft.py index db488eb1ed9..e5876b4c3f5 100644 --- a/examples/cdp_mode/raw_sannysoft.py +++ b/examples/cdp_mode/raw_sannysoft.py @@ -2,7 +2,7 @@ with SB(uc=True, test=True) as sb: sb.activate_cdp_mode() - sb.open("https://bot.sannysoft.com/") + sb.goto("https://bot.sannysoft.com/") sb.flash("#user-agent-result.passed") sb.flash("#webdriver-result.passed") sb.flash("#advanced-webdriver-result.passed") diff --git a/examples/cdp_mode/raw_sms_man.py b/examples/cdp_mode/raw_sms_man.py index afffb01d938..10fe6a3bb99 100644 --- a/examples/cdp_mode/raw_sms_man.py +++ b/examples/cdp_mode/raw_sms_man.py @@ -2,7 +2,7 @@ with SB(uc=True, test=True) as sb: sb.activate_cdp_mode() - sb.open("https://sms-man.com/login") + sb.goto("https://sms-man.com/login") sb.sleep(3) if not sb.is_element_present('input[name="email"]'): sb.solve_captcha() diff --git a/examples/cdp_mode/raw_softpedia.py b/examples/cdp_mode/raw_softpedia.py index 2777ab13202..423ac820478 100644 --- a/examples/cdp_mode/raw_softpedia.py +++ b/examples/cdp_mode/raw_softpedia.py @@ -21,6 +21,6 @@ print("* " + result.text) print(item.querySelector("p").get_attribute("title")) for link in links: - sb.open(link) + sb.goto(link) sb.remove_elements("div.ad") sb.sleep(2) diff --git a/examples/cdp_mode/raw_tab_switching.py b/examples/cdp_mode/raw_tab_switching.py index 11ee963e938..66fe0628607 100644 --- a/examples/cdp_mode/raw_tab_switching.py +++ b/examples/cdp_mode/raw_tab_switching.py @@ -2,10 +2,10 @@ with SB(uc=True, test=True) as sb: sb.activate_cdp_mode() - sb.open("data:text/html,

Page A

") + sb.goto("data:text/html,

Page A

") sb.assert_text("Page A") sb.open_new_tab() - sb.open("data:text/html,

Page B

") + sb.goto("data:text/html,

Page B

") sb.assert_text("Page B") sb.switch_to_tab(0) sb.assert_text("Page A") diff --git a/examples/cdp_mode/raw_tavus.py b/examples/cdp_mode/raw_tavus.py index c80f848dd52..3c4fdfa48f0 100644 --- a/examples/cdp_mode/raw_tavus.py +++ b/examples/cdp_mode/raw_tavus.py @@ -2,7 +2,7 @@ with SB(uc=True, test=True) as sb: sb.activate_cdp_mode() - sb.open("platform.tavus.io/auth/sign-in?is_developer=true") + sb.goto("platform.tavus.io/auth/sign-in?is_developer=true") sb.sleep(3) sb.solve_captcha() sb.sleep(1) diff --git a/examples/cdp_mode/raw_theaters.py b/examples/cdp_mode/raw_theaters.py index 0856ce84ad1..34e5876abdd 100644 --- a/examples/cdp_mode/raw_theaters.py +++ b/examples/cdp_mode/raw_theaters.py @@ -3,7 +3,7 @@ with SB(uc=True, test=True, locale="en", ad_block=True) as sb: sb.activate_cdp_mode() - sb.open("https://architectureofcities.com/roman-theaters") + sb.goto("https://architectureofcities.com/roman-theaters") sb.click_if_visible("#cn-close-notice") sb.click_if_visible('[aria-label="Reject All"]') sb.click_if_visible('span:contains("Continue")') diff --git a/examples/cdp_mode/raw_timezone.py b/examples/cdp_mode/raw_timezone.py index b2afa4ca057..dadba4f28ae 100644 --- a/examples/cdp_mode/raw_timezone.py +++ b/examples/cdp_mode/raw_timezone.py @@ -27,7 +27,7 @@ def main(): sb.add_handler(mycdp.fetch.RequestPaused, request_paused_handler) sb.remove_elements("#right-sidebar") sb.sleep(6) - sb.driver.stop() + sb.quit() if __name__ == "__main__": diff --git a/examples/cdp_mode/raw_timezone_sb.py b/examples/cdp_mode/raw_timezone_sb.py index 57d6d0e983d..f5e0ea2fe14 100644 --- a/examples/cdp_mode/raw_timezone_sb.py +++ b/examples/cdp_mode/raw_timezone_sb.py @@ -6,6 +6,6 @@ sb.activate_cdp_mode(url, tzone="Asia/Kolkata", geoloc=(26.863, 80.94)) sb.remove_elements("#right-sidebar") sb.sleep(5) - sb.open(url, tzone="Asia/Tokyo", geoloc=(35.050681, 136.844728)) + sb.goto(url, tzone="Asia/Tokyo", geoloc=(35.050681, 136.844728)) sb.remove_elements("#right-sidebar") sb.sleep(5) diff --git a/examples/cdp_mode/raw_totalwine.py b/examples/cdp_mode/raw_totalwine.py index 2da380d47fb..1f3454e9c07 100644 --- a/examples/cdp_mode/raw_totalwine.py +++ b/examples/cdp_mode/raw_totalwine.py @@ -3,7 +3,7 @@ with SB(uc=True, test=True, locale="en") as sb: url = "https://www.totalwine.com/" sb.activate_cdp_mode() - sb.open(url) + sb.goto(url) sb.sleep(1.8) search_box = 'input[data-at="header-search-text"]' search = "The Land by Psagot Cabernet" diff --git a/examples/cdp_mode/raw_xhr_sb.py b/examples/cdp_mode/raw_xhr_sb.py index 229cd65fbfd..7130bcbff18 100644 --- a/examples/cdp_mode/raw_xhr_sb.py +++ b/examples/cdp_mode/raw_xhr_sb.py @@ -62,7 +62,7 @@ async def receiveXHR(page, requests): listenXHR(tab) # Change url to something that makes ajax requests - sb.open("https://learn.microsoft.com/en-us/") + sb.goto("https://learn.microsoft.com/en-us/") time.sleep(1) for i in range(9): sb.scroll_down(6) diff --git a/examples/cdp_mode/raw_xpath.py b/examples/cdp_mode/raw_xpath.py index 487b1e6b68b..82559e328d9 100644 --- a/examples/cdp_mode/raw_xpath.py +++ b/examples/cdp_mode/raw_xpath.py @@ -1,16 +1,17 @@ -"""Test that CDP Mode can autodetect and use XPath selectors.""" +"""Test that CDP Mode can autodetect and use XPath selectors. +Also shows that CDP Mode methods can be called via sb.cdp.""" from seleniumbase import SB with SB(uc=True, test=True) as sb: sb.activate_cdp_mode() - sb.open("https://seleniumbase.io/demo_page") + sb.cdp.goto("https://seleniumbase.io/demo_page") sb.cdp.highlight('//input[@id="myTextInput"]') sb.cdp.type('//*[@id="myTextInput"]', "XPath Test!") - sb.sleep(0.5) + sb.cdp.sleep(0.5) sb.cdp.highlight('//button[contains(text(),"(Green)")]') sb.cdp.click('//button[starts-with(text(),"Click Me")]') sb.cdp.assert_element('//button[contains(., "Purple")]') - sb.sleep(0.5) + sb.cdp.sleep(0.5) sb.cdp.highlight("//table/tbody/tr/td/h3") sb.cdp.highlight("//table/tbody/tr[1]/td[2]/h2") sb.cdp.assert_text("SeleniumBase", "//table//h2") diff --git a/examples/cdp_mode/raw_zoro.py b/examples/cdp_mode/raw_zoro.py index 4e71a7672ba..fb0baef0b6d 100644 --- a/examples/cdp_mode/raw_zoro.py +++ b/examples/cdp_mode/raw_zoro.py @@ -3,7 +3,7 @@ with SB(uc=True, test=True, locale="en") as sb: url = "https://www.zoro.com/" sb.activate_cdp_mode() - sb.open(url) + sb.goto(url) sb.sleep(1.2) search_box = "input#searchInput" search = "Flir Thermal Camera" diff --git a/examples/coffee_cart_tests.py b/examples/coffee_cart_tests.py index f0ab06016ec..39eb5763c5a 100644 --- a/examples/coffee_cart_tests.py +++ b/examples/coffee_cart_tests.py @@ -6,13 +6,13 @@ class CoffeeCartTests(BaseCase): def test_1_verify_nav_link_to_coffee_cart(self): - self.open("https://seleniumbase.io/help_docs/customizing_test_runs/") + self.goto("https://seleniumbase.io/help_docs/customizing_test_runs/") self.js_click('nav a:contains("Coffee Cart")') self.assert_title("Coffee Cart") self.assert_element('h4:contains("Espresso")') def test_buy_one_cappuccino(self): - self.open("https://seleniumbase.io/coffee/") + self.goto("https://seleniumbase.io/coffee/") self.assert_title("Coffee Cart") self.click('div[data-test="Cappuccino"]') self.assert_exact_text("cart (1)", 'a[aria-label="Cart page"]') @@ -28,7 +28,7 @@ def test_buy_one_cappuccino(self): @parameterized.expand([[False], [True]]) def test_coffee_promo_with_preview(self, accept_promo): - self.open("https://seleniumbase.io/coffee/") + self.goto("https://seleniumbase.io/coffee/") self.assert_title("Coffee Cart") self.click('div[data-test="Espresso"]') self.click('div[data-test="Americano"]') @@ -61,7 +61,7 @@ def test_coffee_promo_with_preview(self, accept_promo): self.assert_text("Thanks for your purchase.", "div#app div.success") def test_context_click_add_coffee(self): - self.open("https://seleniumbase.io/coffee/") + self.goto("https://seleniumbase.io/coffee/") self.assert_title("Coffee Cart") self.context_click('div[data-test="Espresso_Macchiato"]') self.click('form button:contains("Yes")') @@ -75,7 +75,7 @@ def test_context_click_add_coffee(self): self.assert_text("Thanks for your purchase.", "div#app div.success") def test_remove_added_coffee(self): - self.open("https://seleniumbase.io/coffee/") + self.goto("https://seleniumbase.io/coffee/") self.assert_title("Coffee Cart") self.assert_exact_text("cart (0)", 'a[aria-label="Cart page"]') self.assert_exact_text("Total: $0.00", "button.pay") diff --git a/examples/custom_settings.py b/examples/custom_settings.py index a9479015b74..480d1bf22a4 100644 --- a/examples/custom_settings.py +++ b/examples/custom_settings.py @@ -43,7 +43,7 @@ These methods add JS waits, such as self.wait_for_ready_state_complete(), which waits for document.readyState to be "complete" after Selenium actions. """ -# Called after self.open(URL), NOT driver.get(URL) +# Called after self.goto(url), NOT driver.get(url) WAIT_FOR_RSC_ON_PAGE_LOADS = True # Called after self.click(selector), NOT element.click() WAIT_FOR_RSC_ON_CLICKS = False diff --git a/examples/dialog_boxes/ReadMe.md b/examples/dialog_boxes/ReadMe.md index bcd3093dfa5..e4aa10a4f59 100644 --- a/examples/dialog_boxes/ReadMe.md +++ b/examples/dialog_boxes/ReadMe.md @@ -23,13 +23,13 @@ pytest test_dialog_boxes.py

Here's a code snippet from that:

```python -self.open("https://xkcd.com/1920/") +self.goto("https://xkcd.com/1920/") skip_button = ["SKIP", "red"] # Can be a [text, color] list or tuple. buttons = ["Fencing", "Football", "Metaball", "Go/Chess", skip_button] message = "Choose a sport:" choice = self.get_jqc_button_input(message, buttons) if choice == "Fencing": - self.open("https://xkcd.com/1424/") + self.goto("https://xkcd.com/1424/") ``` * You can create forms that include buttons and input fields. diff --git a/examples/dialog_boxes/dialog_box_tour.py b/examples/dialog_boxes/dialog_box_tour.py index e02f830d318..d2b935deebd 100644 --- a/examples/dialog_boxes/dialog_box_tour.py +++ b/examples/dialog_boxes/dialog_box_tour.py @@ -4,7 +4,7 @@ class DialogBoxTests(BaseCase): def test_dialog_boxes(self): - self.open("https://xkcd.com/1920/") + self.goto("https://xkcd.com/1920/") self.assert_element('img[alt="Emoji Sports"]') self.highlight("#comic img") @@ -15,16 +15,16 @@ def test_dialog_boxes(self): while choice != "STOP": choice = self.get_jqc_button_input(message, buttons) if choice == "Fencing": - self.open("https://xkcd.com/1424/") + self.goto("https://xkcd.com/1424/") buttons.remove("Fencing") elif choice == "Football": - self.open("https://xkcd.com/1107/") + self.goto("https://xkcd.com/1107/") buttons.remove("Football") elif choice == "Metaball": - self.open("https://xkcd.com/1507/") + self.goto("https://xkcd.com/1507/") buttons.remove("Metaball") elif choice == "Go/Chess": - self.open("https://xkcd.com/1287/") + self.goto("https://xkcd.com/1287/") buttons.remove("Go/Chess") else: break @@ -38,20 +38,20 @@ def test_dialog_boxes(self): buttons = [(btn_text_1, "green"), (btn_text_2, "purple")] choice_2 = self.get_jqc_button_input(message, buttons) if choice_2 == btn_text_2: - self.open_if_not_url("https://xkcd.com/1287/") + self.goto_if_not_url("https://xkcd.com/1287/") message = "Brain sports count as sports!

" message += "Are you ready for more?" self.get_jqc_button_input(message, ["Let's Go!"]) break - self.open("https://xkcd.com/1117/") + self.goto("https://xkcd.com/1117/") sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_10.png" self.set_attributes("#news img", "src", sb_banner_logo) options = [("theme", "material"), ("width", "52%")] message = 'With one button, you can press "Enter/Return", "Y", or "1".' self.get_jqc_button_input(message, ["OK"], options) - self.open("https://xkcd.com/556/") + self.goto("https://xkcd.com/556/") self.set_attributes("#news img", "src", sb_banner_logo) options = [("theme", "bootstrap"), ("width", "52%")] message = 'If the lowercase button text is "yes" or "no", ' @@ -68,7 +68,7 @@ def test_dialog_boxes(self): message += "You can learn more from SeleniumBase Docs..." choice = self.get_jqc_button_input(message, ["OK"], options) - self.open("https://seleniumbase.io") + self.goto("https://seleniumbase.io") self.set_jqc_theme("light", color="green", width="38%") message = "This is the SeleniumBase Docs website!

" message += "What would you like to search for?
" @@ -85,7 +85,7 @@ def test_dialog_boxes(self): self.set_jqc_theme("bootstrap", color="green", width="32%") self.get_jqc_button_input("You found search results!", ["OK"]) - self.open("https://seleniumbase.io/help_docs/ReadMe/") + self.goto("https://seleniumbase.io/help_docs/ReadMe/") self.highlight("h1") self.slow_scroll_to('article p a[href*="/examples/ReadMe/"]') zoom_in = 'article p a[href*="/examples/ReadMe/"]{zoom: 1.8;}' @@ -104,10 +104,10 @@ def test_dialog_boxes(self): buttons = ["SeleniumBase.io", "Wikipedia.org"] text, choice = self.get_jqc_form_inputs(message, buttons) if choice == "SeleniumBase.io": - self.open("https://seleniumbase.io/") + self.goto("https://seleniumbase.io/") self.highlight_type('input[aria-label="Search"]', text + "\n") else: - self.open("https://en.wikipedia.org/wiki/Special:Search") + self.goto("https://en.wikipedia.org/wiki/Special:Search") self.highlight_type('input[id*="search"]', text) self.sleep(1) self.click("#searchform button") diff --git a/examples/edge_test.py b/examples/edge_test.py index bc4f3b32308..b9b1a931f97 100644 --- a/examples/edge_test.py +++ b/examples/edge_test.py @@ -6,15 +6,15 @@ class EdgeTests(BaseCase): def test_edge(self): if self.browser != "edge": - self.open_if_not_url("about:blank") + self.goto_if_not_url("about:blank") print("\n This test is only for Microsoft Edge (Chromium)!") print(' (Run this test using "--edge" or "--browser=edge")') self.skip('Use "--edge" or "--browser=edge"') elif self.headless: - self.open_if_not_url("about:blank") + self.goto_if_not_url("about:blank") print("\n This test is NOT designed for Headless Mode!") self.skip('Do NOT use "--headless" with this test!') - self.open("edge://settings/help") + self.goto("edge://settings/help") self.assert_element("app-shell") self.assert_text("Microsoft Edge", "app-shell") self.sleep(2) diff --git a/examples/github_test.py b/examples/github_test.py index 744adbccfdd..e9feda8a1c4 100644 --- a/examples/github_test.py +++ b/examples/github_test.py @@ -5,10 +5,10 @@ class GitHubTests(BaseCase): def test_github(self): if self.headless or self.page_load_strategy == "none": - self.open_if_not_url("about:blank") + self.goto_if_not_url("about:blank") print("\n Unsupported mode for this test.") self.skip("Unsupported mode for this test.") - self.open("https://github.com/seleniumbase/SeleniumBase") + self.goto("https://github.com/seleniumbase/SeleniumBase") self.click_if_visible('[data-action="click:signup-prompt#dismiss"]') self.highlight('[class*="PageLayout-Content-"][data-width="large"]') self.highlight('[class*="PageLayout-PaneWrapper"]') diff --git a/examples/hack_the_planet.py b/examples/hack_the_planet.py index f9d77322094..217d860dcbf 100644 --- a/examples/hack_the_planet.py +++ b/examples/hack_the_planet.py @@ -13,7 +13,7 @@ def test_all_your_base_are_belong_to_us(self): sb_dashboard_logo = "//seleniumbase.github.io/img/dash_pie_3.png" wiki = "https://en.wikipedia.org/wiki/All_your_base_are_belong_to_us" - self.open(wiki) + self.goto(wiki) self.click_if_visible('button[aria-label="Close"]') self.set_text_content("h1#firstHeading", aybabtu) self.set_text_content("#ca-history a", aybabtu) @@ -32,7 +32,7 @@ def test_all_your_base_are_belong_to_us(self): self.highlight("img[src*=Ayb]", loops=10, scroll=False) if not self.headless: - self.open("https://www.apple.com/store") + self.goto("https://www.apple.com/store") self.set_text_content("div.rs-shop-subheader", aybabtu) self.set_text_content('#shelf-1 a[href*="mac"]', "ALL") self.set_text_content('#shelf-1 a[href*="iphone"]', "YOUR") @@ -57,7 +57,7 @@ def test_all_your_base_are_belong_to_us(self): self.highlight("#shelf-2_section h2", loops=5, scroll=False) self.highlight("#shelf-2_section span", loops=6, scroll=False) - self.open("https://google.com/ncr") + self.goto("https://google.com/ncr") self.click_if_visible('button:contains("Accept all")') self.hide_elements("iframe") if self.is_element_visible('a[href*="about.google"]'): @@ -85,11 +85,11 @@ def test_all_your_base_are_belong_to_us(self): self.highlight('a[href*="google.com/img"]', loops=3) self.highlight('form[role="search"]', loops=8) - self.open("https://github.com/solutions/use-case/devops") + self.goto("https://github.com/solutions/use-case/devops") self.set_text_content("#hero-section-brand-heading", aybabtu) self.highlight("#hero-section-brand-heading", loops=14, scroll=False) - self.open("https://dev.to/top/infinity") + self.goto("https://dev.to/top/infinity") self.click_if_visible('button[aria-label="Close campaign banner"]') self.click_if_visible('svg[aria-label="Close campaign banner"]') self.click_if_visible('button[id*="sponsorship-close-trigger"]') @@ -130,7 +130,7 @@ def test_all_your_base_are_belong_to_us(self): self.highlight('main h2 a[id*="article"]', loops=7, scroll=False) self.highlight("section.crayons-card", loops=7, scroll=False) - self.open("https://store.steampowered.com/") + self.goto("https://store.steampowered.com/") self.set_text_content('a[href*="steamcommunity.com/"]', " ") self.set_text_content('div.content a[href*="/about/"]', " ") self.set_text_content('div.content a[href*="help.steam"]', aybabtu) @@ -138,7 +138,7 @@ def test_all_your_base_are_belong_to_us(self): self.add_css_style(zoom_in) self.highlight('div.content a[href*="help.steam"]', loops=12) - self.open("https://xkcd.com/286/") + self.goto("https://xkcd.com/286/") self.set_text_content('a[href="/archive"]', "ALL") self.set_text_content('a[href*="what-if"]', "YOUR BASE") self.set_text_content('a[href*="/about"]', abtu) @@ -161,18 +161,18 @@ def test_all_your_base_are_belong_to_us(self): self.highlight('a[rel="next"]', loops=3, scroll=False) self.highlight("#ctitle", loops=7, scroll=False) - self.open("https://www.nintendo.com/whatsnew/") + self.goto("https://www.nintendo.com/whatsnew/") self.set_text_content("main section h1", aybabtu) self.highlight("main section h1", loops=10, scroll=False) if not self.headless: - self.open("https://support.gog.com/hc/en-us?product=gog") + self.goto("https://support.gog.com/hc/en-us?product=gog") self.set_text_content("div.intro-title", aybabtu) self.set_text_content("h4", aybabtu) self.highlight("div.intro-title", loops=8, scroll=False) self.highlight("h4", loops=8, scroll=False) - self.open( + self.goto( "https://slack.com/help/articles/204379773-Upload-a-Slack-icon" ) self.set_text_content("h1", aybabtu) @@ -180,7 +180,7 @@ def test_all_your_base_are_belong_to_us(self): self.highlight("h1", loops=4, scroll=False) self.highlight("h1.article_title", loops=5, scroll=False) - self.open("https://kubernetes.io/") + self.goto("https://kubernetes.io/") self.set_text_content('nav a[href="/docs/home/"]', "ALL") self.set_text_content('nav a[href="/blog/"]', "YOUR") self.set_text_content('nav a[href="/training/"]', "BASE") @@ -201,7 +201,7 @@ def test_all_your_base_are_belong_to_us(self): if self.is_element_visible("h1"): self.highlight("h1", loops=6, scroll=False) - self.open("https://www.selenium.dev/") + self.goto("https://www.selenium.dev/") if self.is_element_visible('button[data-dismiss="alert"] span'): self.js_click('button[data-dismiss="alert"] span', scroll=False) self.set_attributes("a.dropdown-toggle", "class", "nav-link") @@ -229,7 +229,7 @@ def test_all_your_base_are_belong_to_us(self): self.highlight("div.mx-auto p", loops=6, scroll=False) self.highlight("h2", loops=8, scroll=False) - self.open("https://www.python.org/") + self.goto("https://www.python.org/") self.set_text_content('a[class="donate-button"]', ayb) self.set_text_content("#about a", "ALL") self.set_text_content("#downloads a", "YOUR") @@ -248,11 +248,11 @@ def test_all_your_base_are_belong_to_us(self): self.highlight("#news a", loops=1, scroll=False) self.highlight("#events a", loops=2, scroll=False) - self.open("https://docs.pytest.org/") + self.goto("https://docs.pytest.org/") self.set_text_content("h1", "pytest: " + aybabtu) self.highlight("h1", loops=10, scroll=False) - self.open("https://wordpress.com/") + self.goto("https://wordpress.com/") zoom_out = "h1{zoom: 0.8;-moz-transform: scale(0.8);}" self.add_css_style(zoom_out) zoom_in = "a.wp-element-button{zoom: 1.4;-moz-transform: scale(1.4);}" @@ -262,11 +262,11 @@ def test_all_your_base_are_belong_to_us(self): self.highlight("h1", loops=8, scroll=False) self.highlight("a.wp-element-button", loops=8, scroll=False) - self.open("https://seleniumbase.com/") + self.goto("https://seleniumbase.com/") self.set_text_content("h1", aybabtu) self.highlight("h1", loops=10, scroll=False) - self.open("https://pypi.org/") + self.goto("https://pypi.org/") self.set_text_content('a[href="/sponsors/"]', aybabtu) self.set_text_content("h1", aybabtu) self.set_value("input#search", aybabtu, scroll=False) @@ -274,7 +274,7 @@ def test_all_your_base_are_belong_to_us(self): self.highlight("h1", loops=6, scroll=False) self.highlight("input#search", loops=8, scroll=False) - self.open("https://status.iboss.com/ibcloud/app/cloudStatus.html") + self.goto("https://status.iboss.com/ibcloud/app/cloudStatus.html") self.wait_for_element_clickable('div[translate*="cloudStatus"]') self.set_text_content('div[translate*="cloudStatus"]', ayb) self.set_text_content('div[translate*="maintenance"]', "ARE") @@ -288,16 +288,16 @@ def test_all_your_base_are_belong_to_us(self): self.highlight('div[translate*="incident"]', loops=3) self.highlight("h1", loops=9, scroll=False) - self.open("https://git-scm.com/") + self.goto("https://git-scm.com/") self.set_text_content("span#tagline", aybabtu) self.highlight("span#tagline", loops=10, scroll=False) - self.open("https://pragprog.com/") + self.goto("https://pragprog.com/") self.set_text_content("header p", aybabtu) zoom_in = "header p{zoom: 1.35;-moz-transform: scale(1.35);}" self.add_css_style(zoom_in) self.highlight("header p", loops=10, scroll=False) - self.open("https://seleniumbase.io/") + self.goto("https://seleniumbase.io/") self.set_text_content("h1", aybabtu) self.highlight("h1", loops=10, scroll=False) diff --git a/examples/handle_alert_test.py b/examples/handle_alert_test.py index c7eed9b8cb9..570e329c918 100644 --- a/examples/handle_alert_test.py +++ b/examples/handle_alert_test.py @@ -4,7 +4,7 @@ class HandleAlertTests(BaseCase): def test_alerts(self): - self.open("about:blank") + self.goto("about:blank") self.execute_script('window.alert("ALERT!!!");') self.sleep(1) # Not needed (Lets you see the alert pop up) self.assert_true(self.is_alert_present()) diff --git a/examples/iframe_tests.py b/examples/iframe_tests.py index 0902819180b..1de66c38587 100644 --- a/examples/iframe_tests.py +++ b/examples/iframe_tests.py @@ -5,7 +5,7 @@ class FrameTests(BaseCase): def test_iframe_basics(self): - self.open("https://seleniumbase.io/w3schools/iframes.html") + self.goto("https://seleniumbase.io/w3schools/iframes.html") self.assert_title("iframe Testing") self.click("button#runbtn") self.switch_to_frame("iframeResult") # Enter the iframe @@ -22,7 +22,7 @@ def test_iframe_basics(self): self.highlight('iframe[title="Iframe Example"]') def test_iframes_with_context_manager(self): - self.open("https://seleniumbase.io/w3schools/iframes.html") + self.goto("https://seleniumbase.io/w3schools/iframes.html") self.assert_title("iframe Testing") self.click("button#runbtn") with self.frame_switch("iframeResult"): @@ -37,7 +37,7 @@ def test_iframes_with_context_manager(self): self.highlight('iframe[title="Iframe Example"]') def test_set_content_to_frame(self): - self.open("https://seleniumbase.io/w3schools/iframes.html") + self.goto("https://seleniumbase.io/w3schools/iframes.html") self.assert_title("iframe Testing") self.click("button#runbtn") self.set_content_to_frame("iframeResult") diff --git a/examples/locale_code_test.py b/examples/locale_code_test.py index aea662d8713..323eb63f0e1 100644 --- a/examples/locale_code_test.py +++ b/examples/locale_code_test.py @@ -4,11 +4,11 @@ class LocaleCodeTests(BaseCase): def test_locale_code(self): - self.open("about:blank") + self.goto("about:blank") locale_code = self.get_locale_code() # navigator.language print("\nYour Browser's Locale Code: %s" % locale_code) if self.browser == "chrome" and not self.headless: - self.open("chrome://settings/languages") + self.goto("chrome://settings/languages") language_info = self.get_text( "settings-ui::shadow " "settings-main::shadow " diff --git a/examples/master_qa/ReadMe.md b/examples/master_qa/ReadMe.md index 424f5bd3b0e..a985f72bc4b 100644 --- a/examples/master_qa/ReadMe.md +++ b/examples/master_qa/ReadMe.md @@ -13,12 +13,12 @@ from seleniumbase import MasterQA class MasterQATests(MasterQA): def test_masterqa(self): - self.open("https://xkcd.com/1700/") + self.goto("https://xkcd.com/1700/") self.verify("Do you see a webcomic?") - self.open("https://seleniumbase.io/demo_page") + self.goto("https://seleniumbase.io/demo_page") self.highlight('table') self.verify("Do you see elements in a table?") - self.open("https://seleniumbase.io/devices/") + self.goto("https://seleniumbase.io/devices/") self.highlight("div.mockup-wrapper") self.verify("Do you see 4 computer devices?") ``` diff --git a/examples/master_qa/basic_masterqa_test_0.py b/examples/master_qa/basic_masterqa_test_0.py index c62fab3fee1..05b162fd689 100644 --- a/examples/master_qa/basic_masterqa_test_0.py +++ b/examples/master_qa/basic_masterqa_test_0.py @@ -4,12 +4,12 @@ class MasterQATests(MasterQA): def test_masterqa(self): - self.open("https://seleniumbase.io/devices/") + self.goto("https://seleniumbase.io/devices/") self.highlight("div.mockup-wrapper") self.verify("Do you see 4 computer devices?") - self.open("https://seleniumbase.io/demo_page") + self.goto("https://seleniumbase.io/demo_page") self.highlight("table") self.verify("Do you see elements in a table?") - self.open("https://xkcd.com/1700/") + self.goto("https://xkcd.com/1700/") self.highlight("#comic") self.verify("Do you see a webcomic?") diff --git a/examples/master_qa/masterqa_test_1.py b/examples/master_qa/masterqa_test_1.py index c3086843cfd..4a97f6dafd1 100644 --- a/examples/master_qa/masterqa_test_1.py +++ b/examples/master_qa/masterqa_test_1.py @@ -4,24 +4,24 @@ class MasterQATests(MasterQA): def test_xkcd(self): - self.open("https://xkcd.com/1512/") + self.goto("https://xkcd.com/1512/") for i in range(4): self.click('a[rel="next"]') for i in range(3): self.click('a[rel="prev"]') self.verify() - self.open("https://xkcd.com/1520/") + self.goto("https://xkcd.com/1520/") for i in range(2): self.click('a[rel="next"]') self.verify("Can you find the moon?") self.click('a[rel="next"]') self.verify("Do the drones look safe?") - self.open("https://seleniumbase.io/devices/") + self.goto("https://seleniumbase.io/devices/") self.type("input#urlInput", "seleniumbase.io/error_page\n") self.verify("Do you see Octocat in a Jedi knight robe?") - self.open("https://xkcd.com/213/") + self.goto("https://xkcd.com/213/") for i in range(5): self.click('a[rel="prev"]') self.verify("Does the page say 'Abnormal Expressions'?") diff --git a/examples/migration/protractor/example_test.py b/examples/migration/protractor/example_test.py index 57b54f13e3f..b6ded63feaf 100644 --- a/examples/migration/protractor/example_test.py +++ b/examples/migration/protractor/example_test.py @@ -4,12 +4,12 @@ class AngularJSHomePageTests(BaseCase): def test_greet_user(self): - self.open("http://www.angularjs.org") + self.goto("http://www.angularjs.org") self.type('[ng-model="yourName"]', "Julie") self.assert_exact_text("Hello Julie!", "h1.ng-binding") def test_todo_list(self): - self.open("http://www.angularjs.org") + self.goto("http://www.angularjs.org") todo_selector = '[ng-repeat="todo in todoList.todos"]' # Verify that the todos are listed self.wait_for_element(todo_selector) diff --git a/examples/migration/protractor/input_test.py b/examples/migration/protractor/input_test.py index 141a2f38aa4..59eb491f48c 100644 --- a/examples/migration/protractor/input_test.py +++ b/examples/migration/protractor/input_test.py @@ -5,6 +5,6 @@ class AngularMaterialInputTests(BaseCase): def test_invalid_input(self): # Test that there's an error for an invalid input - self.open("https://material.angular.io/components/input/examples") + self.goto("https://material.angular.io/components/input/examples") self.type('input[type="email"]', "invalid") self.assert_element("mat-error") diff --git a/examples/migration/protractor/mat_paginator_test.py b/examples/migration/protractor/mat_paginator_test.py index f6797b65629..194e702553c 100644 --- a/examples/migration/protractor/mat_paginator_test.py +++ b/examples/migration/protractor/mat_paginator_test.py @@ -4,7 +4,7 @@ class AngularMaterialPaginatorTests(BaseCase): def test_pagination(self): - self.open("https://material.angular.io/components/paginator/examples") + self.goto("https://material.angular.io/components/paginator/examples") self.click_if_visible("button.mat-mdc-button") self.scroll_to("div.mat-mdc-paginator-page-size") # Set pagination to 5 items per page diff --git a/examples/migration/raw_selenium/refined_raw.py b/examples/migration/raw_selenium/refined_raw.py index eb6da5f75d6..94dbf94a9ef 100644 --- a/examples/migration/raw_selenium/refined_raw.py +++ b/examples/migration/raw_selenium/refined_raw.py @@ -73,7 +73,7 @@ def wait_for_element_not_visible( % (selector, timeout) ) - def open(self, url): + def goto(self, url): self.driver.get(url) def click(self, selector, by="css selector", timeout=7): @@ -106,7 +106,7 @@ def assert_element_not_visible( self.wait_for_element_not_visible(selector, by=by, timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/migration/raw_selenium/simple_sbase.py b/examples/migration/raw_selenium/simple_sbase.py index 388e812c4dc..917f82d9e92 100644 --- a/examples/migration/raw_selenium/simple_sbase.py +++ b/examples/migration/raw_selenium/simple_sbase.py @@ -5,7 +5,7 @@ class CleanSeleniumBase(BaseCase): def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/ReadMe.md b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/ReadMe.md index f25a6f913dc..8f59e98fe63 100644 --- a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/ReadMe.md +++ b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/ReadMe.md @@ -358,7 +358,7 @@ BaseCase.main(__name__, __file__) class SeleniumBaseTestCase(BaseCase): def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/non_test_scripts/raw_script_sb.py b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/non_test_scripts/raw_script_sb.py index 23460633726..6c1b36a226b 100644 --- a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/non_test_scripts/raw_script_sb.py +++ b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/non_test_scripts/raw_script_sb.py @@ -1,7 +1,7 @@ from seleniumbase import SB with SB() as sb: - sb.open("https://www.saucedemo.com") + sb.goto("https://www.saucedemo.com") sb.type("#user-name", "standard_user") sb.type("#password", "secret_sauce\n") sb.assert_element("div.inventory_list") diff --git a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_case_sb.py b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_case_sb.py index b09d8e789e3..b6f8d815f27 100644 --- a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_case_sb.py +++ b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_case_sb.py @@ -5,7 +5,7 @@ class SeleniumBaseTestCase(BaseCase): def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_case.py b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_case.py index 51ad7dc57c0..282c4a6d546 100644 --- a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_case.py +++ b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_case.py @@ -12,7 +12,7 @@ def test_add_item_to_cart(self): self.activate_cdp_mode() self.reconnect() # Reconnects WebDriver to use Selenium driver = self.driver # Selenium API - endpoint_url = self.cdp.get_endpoint_url() + endpoint_url = self.get_endpoint_url() with sync_playwright() as p: browser = p.chromium.connect_over_cdp(endpoint_url) page = browser.contexts[0].pages[0] # Playwright API diff --git a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_fixture.py b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_fixture.py index f423bf81844..bd0373c93f9 100644 --- a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_fixture.py +++ b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_fixture.py @@ -12,7 +12,7 @@ def setUp(self): super().setUp() self.activate_cdp_mode() self.reconnect() # Reconnects WebDriver to use Selenium - endpoint_url = self.cdp.get_endpoint_url() + endpoint_url = self.get_endpoint_url() self.playwright = sync_playwright().start() browser = self.playwright.chromium.connect_over_cdp(endpoint_url) self.page = browser.contexts[0].pages[0] diff --git a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_fixture_tracing.py b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_fixture_tracing.py index 402f24ea098..0f5dfff5c1d 100644 --- a/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_fixture_tracing.py +++ b/examples/migration/raw_selenium/to_playwright/01_hybrid_approach/raw_hybrid_fixture_tracing.py @@ -18,7 +18,7 @@ def setUp(self): super().setUp() self.activate_cdp_mode() self.reconnect() # Reconnects WebDriver to use Selenium - endpoint_url = self.cdp.get_endpoint_url() + endpoint_url = self.get_endpoint_url() self.playwright = sync_playwright().start() browser = self.playwright.chromium.connect_over_cdp(endpoint_url) self.context = browser.contexts[0] diff --git a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/ReadMe.md b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/ReadMe.md index f6faaa78d55..1c50157df1a 100644 --- a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/ReadMe.md +++ b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/ReadMe.md @@ -85,7 +85,7 @@ class RawSeleniumAdapter(TestCase): % (selector, timeout) ) - def open(self, url): + def goto(self, url): self.driver.get(url) def click(self, selector, by="css selector", timeout=7): @@ -118,7 +118,7 @@ class RawSeleniumAdapter(TestCase): self.wait_for_element_not_visible(selector, by=by, timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -170,7 +170,7 @@ class PlaywrightAdapter(TestCase): self.page.close() self.context.close() - def open(self, url): + def goto(self, url): self.page.goto(url) def click(self, selector, timeout=7): @@ -204,7 +204,7 @@ class PlaywrightAdapter(TestCase): expect(self.page.locator(selector)).to_be_hidden(timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -275,7 +275,7 @@ class PlaywrightAdapterWithTracing(TestCase): self.page.close() self.context.close() - def open(self, url): + def goto(self, url): self.page.goto(url) def click(self, selector, timeout=7): @@ -311,7 +311,7 @@ class PlaywrightAdapterWithTracing(TestCase): expect(self.page.locator(selector)).to_be_hidden(timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -345,8 +345,8 @@ class SeleniumBaseAdapter(TestCase): def tearDown(self): self.sb_context.__exit__(None, None, None) - def open(self, url): - self.sb.open(url) + def goto(self, url): + self.sb.goto(url) def click(self, selector, by="css selector", timeout=7): self.sb.click(selector=selector, by=by, timeout=timeout) @@ -371,7 +371,7 @@ class SeleniumBaseAdapter(TestCase): self.sb.assert_element_not_visible(selector, by=by, timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -399,7 +399,7 @@ BaseCase.main(__name__, __file__) class SeleniumBaseTestCase(BaseCase): def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -433,7 +433,7 @@ To understand how the Adapter Pattern applies to browser automation, it helps to | Component | Role in the Pattern | Implementation in these Examples | | :--- | :--- | :--- | | **Client** | The consumer of the service. | The `test_add_item_to_cart()` method. | -| **Target (Interface)** | The set of commands the Client uses. | Methods like `open()`, `click()`, `type()`, and `assert_element()`. | +| **Target (Interface)** | The set of commands the Client uses. | Methods like `goto()`, `click()`, `type()`, and `assert_element()`. | | **Adapter** | The wrapper that translates commands. | Classes like `PlaywrightAdapter` or `SeleniumBaseAdapter`. | | **Adaptee** | The underlying "engine" being adapted. | The specific library (`playwright-python` or `selenium`). | diff --git a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_pw_adapter.py b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_pw_adapter.py index 2062a526320..8f9fe8acd52 100644 --- a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_pw_adapter.py +++ b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_pw_adapter.py @@ -29,7 +29,7 @@ def tearDown(self): self.page.close() self.context.close() - def open(self, url): + def goto(self, url): self.page.goto(url) def click(self, selector, timeout=7): @@ -63,7 +63,7 @@ def assert_element_not_visible(self, selector, timeout=7): expect(self.page.locator(selector)).to_be_hidden(timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_pw_adapter_with_tracing.py b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_pw_adapter_with_tracing.py index 854d30c7136..2bc48b01e61 100644 --- a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_pw_adapter_with_tracing.py +++ b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_pw_adapter_with_tracing.py @@ -45,7 +45,7 @@ def tearDown(self): self.page.close() self.context.close() - def open(self, url): + def goto(self, url): self.page.goto(url) def click(self, selector, timeout=7): @@ -81,7 +81,7 @@ def assert_element_not_visible(self, selector, timeout=7): expect(self.page.locator(selector)).to_be_hidden(timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_sb_adapter.py b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_sb_adapter.py index 59bc7f69feb..1dfb853726b 100644 --- a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_sb_adapter.py +++ b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_sb_adapter.py @@ -11,8 +11,8 @@ def setUp(self): def tearDown(self): self.sb_context.__exit__(None, None, None) - def open(self, url): - self.sb.open(url) + def goto(self, url): + self.sb.goto(url) def click(self, selector, by="css selector", timeout=7): self.sb.click(selector=selector, by=by, timeout=timeout) @@ -37,7 +37,7 @@ def assert_element_not_visible( self.sb.assert_element_not_visible(selector, by=by, timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_se_adapter.py b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_se_adapter.py index 18cf6c552a4..a6507b250ec 100644 --- a/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_se_adapter.py +++ b/examples/migration/raw_selenium/to_playwright/02_adapter_pattern/raw_se_adapter.py @@ -73,7 +73,7 @@ def wait_for_element_not_visible( % (selector, timeout) ) - def open(self, url): + def goto(self, url): self.driver.get(url) def click(self, selector, by="css selector", timeout=7): @@ -106,7 +106,7 @@ def assert_element_not_visible( self.wait_for_element_not_visible(selector, by=by, timeout=timeout) def test_add_item_to_cart(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") diff --git a/examples/my_first_test.py b/examples/my_first_test.py index 2bee06c11b4..e98cfb029e3 100644 --- a/examples/my_first_test.py +++ b/examples/my_first_test.py @@ -5,7 +5,7 @@ class MyTestClass(BaseCase): def test_swag_labs(self): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -73,8 +73,8 @@ def test_swag_labs(self): # 4. There are duplicate method names that exist for the same method: # (This makes it easier to switch over from other test frameworks.) # Example: -# self.open() = self.visit() = self.open_url() = self.goto() -# self.type() = self.update_text() = self.input() = self.fill() +# self.goto() = self.open() = self.visit() +# self.type() = self.update_text() = self.fill() # self.send_keys() = self.add_text() # self.get_element() = self.wait_for_element_present() # self.find_element() = self.wait_for_element_visible() @@ -84,10 +84,10 @@ def test_swag_labs(self): # self.find_text() = self.wait_for_text_visible() # = self.wait_for_text() # self.click_link("LinkText") = self.click("link=LinkText") -# = self.click_link_text("LinkText") -# = self.click('a:contains("LinkText")') +# = self.click_link_text("LinkText") +# = self.click('a:contains("LinkText")') # * self.get(url) is SPECIAL: * -# If {url} is a valid URL, self.get() works just like self.open() +# If {url} is a valid URL, self.get() works just like self.goto() # Otherwise {url} becomes a selector for calling self.get_element() # # 5. There's usually more than one way to do the same thing. @@ -133,13 +133,13 @@ def test_swag_labs(self): # title = element.get_attribute("title") # ] # -# 6. self.assert_exact_text(TEXT) ignores leading and trailing -# whitespace in the TEXT assertion. +# 6. self.assert_exact_text(text) ignores leading and trailing +# whitespace in the text assertion. # So, self.assert_exact_text("Some Text") accepts [" Some Text "]. # -# 7. self.js_click(SELECTOR) can be used to click on hidden elements. +# 7. self.js_click(selector) can be used to click on hidden elements. # -# 8. self.open(URL) will automatically complete URLs missing a prefix. +# 8. self.goto(url) will automatically complete URLs missing a prefix. # Example: google.com will become https://google.com before opened. # # 9. For the full method list, see one of the following: diff --git a/examples/nth_child_test.py b/examples/nth_child_test.py index 37be73e8863..3e098efb3f0 100644 --- a/examples/nth_child_test.py +++ b/examples/nth_child_test.py @@ -4,7 +4,7 @@ class NthChildSelectorTests(BaseCase): def test_locate_rows_with_colors(self): - self.open("https://xkcd.com/color/rgb/") + self.goto("https://xkcd.com/color/rgb/") tbody = "center > table tbody" if self.headed: self.demo_mode = True diff --git a/examples/offline_examples/test_handle_alerts.py b/examples/offline_examples/test_handle_alerts.py index b45205e8113..13a9c9b4585 100755 --- a/examples/offline_examples/test_handle_alerts.py +++ b/examples/offline_examples/test_handle_alerts.py @@ -6,7 +6,7 @@ @pytest.mark.offline # Can be run with: "pytest -m offline" class OfflineTests(BaseCase): def test_alerts(self): - self.open("data:,") + self.goto("data:,") self.execute_script('window.alert("ALERT!!!");') self.sleep(1) # Not needed (Lets you see the alert pop up) self.accept_alert() diff --git a/examples/offline_examples/test_request_fixture.py b/examples/offline_examples/test_request_fixture.py index e8acbde42ee..d710dff1241 100644 --- a/examples/offline_examples/test_request_fixture.py +++ b/examples/offline_examples/test_request_fixture.py @@ -5,7 +5,7 @@ @pytest.mark.offline def test_request_fixture(request): sb = request.getfixturevalue("sb") - sb.open("data:text/html,

Hello

") + sb.goto("data:text/html,

Hello

") sb.assert_element("html > body") sb.assert_text("Hello", "body p") sb.type("input", "Goodbye") @@ -18,7 +18,7 @@ def test_request_fixture(request): class RequestTests: def test_request_fixture_in_class(self, request): sb = request.getfixturevalue("sb") - sb.open("data:text/html,

Hello

") + sb.goto("data:text/html,

Hello

") sb.assert_element("html > body") sb.assert_text("Hello", "body p") sb.type("input", "Goodbye") diff --git a/examples/offline_examples/test_user_agent.py b/examples/offline_examples/test_user_agent.py index 794fe4ba4ae..2489f3b13a3 100755 --- a/examples/offline_examples/test_user_agent.py +++ b/examples/offline_examples/test_user_agent.py @@ -6,7 +6,7 @@ @pytest.mark.offline # Can be run with: "pytest -m offline" class OfflineTests(BaseCase): def test_get_user_agent(self): - self.open("data:,") + self.goto("data:,") user_agent = self.get_user_agent() print('\nUser Agent = "%s"' % user_agent) @@ -17,7 +17,7 @@ def test_get_user_agent(self): self.skip(msg) print("\n--------------------------") if not self.headless: - self.open("chrome://version/") + self.goto("chrome://version/") self.highlight("#useragent", loops=6) self.sleep(0.8) try: diff --git a/examples/old_wordle_script.py b/examples/old_wordle_script.py index 98530d2adaa..dbc4a396a73 100644 --- a/examples/old_wordle_script.py +++ b/examples/old_wordle_script.py @@ -81,7 +81,7 @@ def test_wordle(self): url = "https://www.nytimes.com/games/wordle/index.html" past_wordle = archive + date + "/" + url print("\n" + past_wordle) - self.open(past_wordle) + self.goto(past_wordle) self.wait_for_element("#wm-ipp-base") self.remove_elements("#wm-ipp-base") self.click("game-app::shadow game-modal::shadow game-icon") diff --git a/examples/parameterized_test.py b/examples/parameterized_test.py index 5e4bea72188..7ba5d7614bd 100644 --- a/examples/parameterized_test.py +++ b/examples/parameterized_test.py @@ -12,7 +12,7 @@ class SearchTests(BaseCase): ] ) def test_parameterized_search(self, search_term, keyword, title_text): - self.open("https://seleniumbase.io/help_docs/how_it_works/") + self.goto("https://seleniumbase.io/help_docs/how_it_works/") self.assert_title_contains("SeleniumBase Docs") self.type('input[aria-label="Search"]', search_term) self.click('mark:contains("%s")' % keyword) diff --git a/examples/performance_test.py b/examples/performance_test.py index c33b92f03a7..825ae317f5d 100644 --- a/examples/performance_test.py +++ b/examples/performance_test.py @@ -32,7 +32,7 @@ class PerformanceClass(BaseCase): def login_to_swag_labs(self): print() with decorators.print_runtime("Open Swag Labs"): - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") diff --git a/examples/presenter/ReadMe.md b/examples/presenter/ReadMe.md index 03763b6b303..c686e811963 100644 --- a/examples/presenter/ReadMe.md +++ b/examples/presenter/ReadMe.md @@ -153,10 +153,10 @@ class MyPresenterClass(BaseCase): 'from seleniumbase import BaseCase\n\n' 'class MyTestClass(BaseCase):\n\n' ' def test_basics(self):\n' - ' self.open("https://store.xkcd.com/search")\n' + ' self.goto("https://store.xkcd.com/search")\n' ' self.type(\'input[name="q"]\', "xkcd book\\n")\n' ' self.assert_text("xkcd: volume 0", "h3")\n' - ' self.open("https://xkcd.com/353/")\n' + ' self.goto("https://xkcd.com/353/")\n' ' self.assert_title("xkcd: Python")\n' ' self.assert_element(\'img[alt="Python"]\')\n' ' self.click(\'a[rel="license"]\')\n' @@ -170,7 +170,7 @@ class MyPresenterClass(BaseCase): 'from seleniumbase import BaseCase\n\n' 'class MyTestClass(BaseCase):\n\n' ' def test_basics(self):\n' - ' self.open("https://store.xkcd.com/search")\n' + ' self.goto("https://store.xkcd.com/search")\n' ' self.type(\'input[name="q"]\', "xkcd book\\n")\n' ' self.assert_text("xkcd: volume 0", "h3")')) self.add_slide( diff --git a/examples/presenter/core_presentation.py b/examples/presenter/core_presentation.py index 5f27d081cee..c120db4b962 100644 --- a/examples/presenter/core_presentation.py +++ b/examples/presenter/core_presentation.py @@ -17,7 +17,7 @@ def test_seleniumbase_chart(self): "from seleniumbase import BaseCase\n\n" "class TestMFALogin(BaseCase):\n\n" " def test_mfa_login(self):\n" - ' self.open("seleniumbase.io/realworld/login")\n' + ' self.goto("seleniumbase.io/realworld/login")\n' ' self.type("#username", "demo_user")\n' ' self.type("#password", "secret_pass")\n' ' self.enter_mfa_code(' diff --git a/examples/presenter/edge_presentation.py b/examples/presenter/edge_presentation.py index b1f5b5db87e..228bccb6708 100644 --- a/examples/presenter/edge_presentation.py +++ b/examples/presenter/edge_presentation.py @@ -23,8 +23,7 @@ def test_presentation(self): ) self.begin_presentation(filename="edge_presentation.html") self.sleep(0.25) - self.open("data:,") - self.open("https://www.bostoncodecamp.com/CC34/Schedule/SessionGrid") + self.goto("https://www.bostoncodecamp.com/CC34/Schedule/SessionGrid") self.highlight("h2", loops=8) if self.is_element_visible('[data-sessionid="467776"]'): self.highlight('div[data-sessionid="467776"]', loops=10) @@ -42,7 +41,7 @@ def test_presentation(self): ) self.play_tour() self.sleep(0.25) - self.open("data:,") + self.goto("data:,") self.create_presentation(theme="beige", transition="fade") self.add_slide( "

About the presenter:

\n" @@ -64,8 +63,7 @@ def test_presentation(self): ) self.begin_presentation(filename="edge_presentation.html") self.sleep(0.25) - self.open("data:,") - self.open( + self.goto( "https://learn.microsoft.com/en-us/microsoft-edge/" "test-and-automation/test-and-automation" ) @@ -94,7 +92,7 @@ def test_presentation(self): ) self.play_tour() self.highlight('a:contains("Use WebDriver to automate")') - self.open( + self.goto( "https://learn.microsoft.com/en-us/" "microsoft-edge/webdriver-chromium/?tabs=python" ) @@ -132,7 +130,7 @@ def test_presentation(self): self.get_new_driver(browser="edge", disable_csp=True) self.maximize_window() - self.open( + self.goto( "https://developer.microsoft.com/en-us/" "microsoft-edge/tools/webdriver/" ) @@ -200,7 +198,7 @@ def test_presentation(self): ) self.play_tour() self.sleep(0.25) - self.open("data:,") + self.goto("data:,") self.create_presentation(theme="sky", transition="fade") self.add_slide( @@ -368,7 +366,7 @@ def test_presentation(self): "BaseCase.main(__name__, __file__)\n\n" "class MyTestClass(BaseCase):\n" " def test_basics(self):\n" - ' self.open("https://www.saucedemo.com")\n' + ' self.goto("https://www.saucedemo.com")\n' ' self.type("#user-name", "standard_user")\n' ' self.type("#password", "secret_sauce\\n")\n' ' self.assert_element("div.inventory_list")\n' @@ -397,8 +395,7 @@ def test_presentation(self): self.get_new_driver(browser="edge") self.maximize_window() - self.open("data:,") - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -424,9 +421,8 @@ def test_presentation(self): self.sleep(0.25) self.get_new_driver(browser="edge") self.maximize_window() - self.open("data:,") self.demo_mode = True - self.open("https://www.saucedemo.com") + self.goto("https://www.saucedemo.com") self.type("#user-name", "standard_user") self.type("#password", "secret_sauce\n") self.assert_element("div.inventory_list") @@ -454,7 +450,7 @@ def test_presentation(self): self.sleep(0.25) self.get_new_driver(browser="edge", is_mobile=True) self.maximize_window() - self.open("https://www.roblox.com/") + self.goto("https://www.roblox.com/") self.assert_element("#download-the-app-container") self.assert_text("Roblox for Android") self.assert_text("Continue in App", "a.content-action-emphasis") @@ -472,7 +468,7 @@ def test_presentation(self): self.get_new_driver(browser="edge") self.maximize_window() self.demo_mode = True - self.open("https://seleniumbase.io/realworld/login") + self.goto("https://seleniumbase.io/realworld/login") self.type("#username", "demo_user") self.type("#password", "secret_pass") self.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") # 6-digit @@ -496,7 +492,7 @@ def test_presentation(self): self.get_new_driver(browser="edge") self.maximize_window() self.demo_mode = True - self.open("https://seleniumbase.io/coffee/") + self.goto("https://seleniumbase.io/coffee/") self.assert_title("Coffee Cart") self.click('div[data-sb="Cappuccino"]') self.click('div[data-sb="Flat-White"]') @@ -520,7 +516,7 @@ def test_presentation(self): self.sleep(0.25) self.get_new_driver(browser="edge") self.maximize_window() - self.open("https://seleniumbase.io/error_page/") + self.goto("https://seleniumbase.io/error_page/") self.highlight('img[alt="500 Error"]') self.highlight("img#parallax_octocat") self.highlight("#parallax_error_text") @@ -535,7 +531,7 @@ def test_presentation(self): self.add_slide( "

Common SeleniumBase methods:


", code=( - "self.open(url) # Navigate the browser window to the URL.\n" + "self.goto(url) # Navigate the browser window to the URL.\n" "self.type(selector, text) # Update field with the text.\n" "self.click(selector) # Click element with the selector.\n" "self.click_link(link_text) # Click link containing text.\n" diff --git a/examples/presenter/fundamentals.py b/examples/presenter/fundamentals.py index eae96d0d352..115316adc7f 100644 --- a/examples/presenter/fundamentals.py +++ b/examples/presenter/fundamentals.py @@ -256,7 +256,7 @@ def test_presentation(self): "BaseCase.main(__name__, __file__)\n\n" "class MyTestClass(BaseCase):\n" " def test_basics(self):\n" - ' self.open("https://www.saucedemo.com")\n' + ' self.goto("https://www.saucedemo.com")\n' ' self.type("#user-name", "standard_user")\n' ' self.type("#password", "secret_sauce\\n")\n' ' self.assert_element("div.inventory_list")\n' @@ -276,7 +276,7 @@ def test_presentation(self): self.add_slide( "

Common SeleniumBase methods:


", code=( - "self.open(url) # Navigate the browser window to the URL.\n" + "self.goto(url) # Navigate the browser window to the URL.\n" "self.type(selector, text) # Update field with the text.\n" "self.click(selector) # Click element with the selector.\n" "self.click_link(link_text) # Click link containing text.\n" diff --git a/examples/presenter/hacking_with_cdp.py b/examples/presenter/hacking_with_cdp.py index 0e5341f11fa..5d4da1a0e01 100644 --- a/examples/presenter/hacking_with_cdp.py +++ b/examples/presenter/hacking_with_cdp.py @@ -5,7 +5,7 @@ class UCPresentationClass(BaseCase): def test_hacking_with_cdp(self): - self.open("data:,") + self.goto("data:,") self.set_window_position(4, 40) self._output_file_saves = False self.create_presentation(theme="serif", transition="none") diff --git a/examples/presenter/multi_uc.py b/examples/presenter/multi_uc.py index c56d3720b90..dfed5714a03 100644 --- a/examples/presenter/multi_uc.py +++ b/examples/presenter/multi_uc.py @@ -9,7 +9,7 @@ def test_multi_threaded(sb): sb.activate_cdp_mode() # If not UC Mode, then 2nd browser sb.set_window_rect(randint(4, 680), randint(8, 380), 840, 520) - sb.open("https://gitlab.com/users/sign_in") + sb.goto("https://gitlab.com/users/sign_in") sb.sleep(2) sb.solve_captcha() sb.assert_text("Username", '[for="user_login"]', timeout=3) diff --git a/examples/presenter/my_presentation.py b/examples/presenter/my_presentation.py index 5d3e6412f29..92e7db478aa 100644 --- a/examples/presenter/my_presentation.py +++ b/examples/presenter/my_presentation.py @@ -52,7 +52,7 @@ def test_presenter(self): "BaseCase.main(__name__, __file__)\n\n" "class MyTestClass(BaseCase):\n" " def test_basics(self):\n" - ' self.open("https://xkcd.com/353/")\n' + ' self.goto("https://xkcd.com/353/")\n' ' self.assert_title("xkcd: Python")\n' " self.assert_element('img[alt=\"Python\"]')\n" " self.click('a[rel=\"license\"]')\n" @@ -69,7 +69,7 @@ def test_presenter(self): "BaseCase.main(__name__, __file__)\n\n" "class MyTestClass(BaseCase):\n" " def test_basics(self):\n" - ' self.open("https://xkcd.com/353/")\n' + ' self.goto("https://xkcd.com/353/")\n' ' self.assert_title("xkcd: Python")\n' " self.assert_element('img[alt=\"Python\"]')\n" " self.click('a[rel=\"license\"]')\n" diff --git a/examples/presenter/ua_presentation_5.py b/examples/presenter/ua_presentation_5.py index 65c9b8af756..cd39343b99f 100644 --- a/examples/presenter/ua_presentation_5.py +++ b/examples/presenter/ua_presentation_5.py @@ -6,7 +6,7 @@ class UA_Presentation_Class(BaseCase): def test_presentation_5(self): - self.open("data:,") + self.goto("data:,") self.set_window_position(4, 40) self._output_file_saves = False self.create_presentation(theme="serif", transition="none") @@ -919,7 +919,7 @@ def test_presentation_5(self): ) self.add_slide( "

" - "Note: Calling open(url) from UC Mode
" + "Note: Calling goto(url) from UC Mode
" "automatically activates CDP Mode now.
" "


ResultTestDurationLinks