")
sb.assert_element("html > body") # selector
sb.assert_text("Hello", "body p") # text, selector
sb.type("input", "Goodbye") # selector, text
diff --git a/examples/upload_file_test.py b/examples/upload_file_test.py
index 3124432c856..e8c8e660c0d 100644
--- a/examples/upload_file_test.py
+++ b/examples/upload_file_test.py
@@ -6,7 +6,7 @@
class FileUploadButtonTests(BaseCase):
def test_file_upload_button(self):
- self.open("https://seleniumbase.io/w3schools/file_upload")
+ self.goto("https://seleniumbase.io/w3schools/file_upload")
self.click("button#runbtn")
self.switch_to_frame("iframeResult")
zoom_in = 'input[type="file"]{zoom: 1.6;-moz-transform: scale(1.6);}'
diff --git a/examples/user_agent_test.py b/examples/user_agent_test.py
index 3e452727390..a0ee97027aa 100644
--- a/examples/user_agent_test.py
+++ b/examples/user_agent_test.py
@@ -4,7 +4,7 @@
class UserAgentTests(BaseCase):
def test_user_agent(self):
- self.open("data:text/html,")
+ self.goto("data:text/html,")
user_agent_detected = self.get_user_agent()
self.set_text_content("h1", user_agent_detected)
self.highlight("h1")
@@ -34,9 +34,9 @@ def test_user_agent(self):
"NF/6.0.1.15.4 NintendoBrowser/5.1.0.20393"
},
)
- self.open("about:blank")
+ self.goto("about:blank")
self.sleep(0.1) # Enough to see that page was refreshed
- self.open("data:text/html,")
+ self.goto("data:text/html,")
user_agent_detected = self.get_user_agent()
self.set_text_content("h1", user_agent_detected)
self.highlight("h1")
diff --git a/examples/verify_undetected.py b/examples/verify_undetected.py
index d99e0f1257f..541ea83007a 100644
--- a/examples/verify_undetected.py
+++ b/examples/verify_undetected.py
@@ -8,7 +8,7 @@
class UndetectedTest(BaseCase):
def test_browser_is_undetected(self):
self.activate_cdp_mode() # If not UC Mode, then 2nd browser
- self.open("https://gitlab.com/users/sign_in")
+ self.goto("https://gitlab.com/users/sign_in")
self.sleep(2)
self.solve_captcha() # (Only runs when a CAPTCHA is visible)
self.assert_text("Username", '[for="user_login"]', timeout=3)
diff --git a/examples/visual_testing/ReadMe.md b/examples/visual_testing/ReadMe.md
index 0a3409d984f..384a1edf95c 100644
--- a/examples/visual_testing/ReadMe.md
+++ b/examples/visual_testing/ReadMe.md
@@ -77,7 +77,7 @@ BaseCase.main(__name__, __file__)
class VisualLayoutTest(BaseCase):
def test_applitools_layout_change_failure(self):
- self.open('https://applitools.com/helloworld?diff1')
+ self.goto('https://applitools.com/helloworld?diff1')
print('\nCreating baseline in "visual_baseline" folder.')
self.check_window(name="helloworld", baseline=True)
# Click a button that changes the text of an element
@@ -111,7 +111,7 @@ BaseCase.main(__name__, __file__)
class VisualLayoutTest(BaseCase):
def test_python_home_layout_change_failure(self):
- self.open('https://python.org/')
+ self.goto('https://python.org/')
print('\nCreating baseline in "visual_baseline" folder.')
self.check_window(name="python_home", baseline=True)
# Remove the "Donate" button
@@ -148,7 +148,7 @@ BaseCase.main(__name__, __file__)
class VisualLayoutTest(BaseCase):
def test_xkcd_layout_change_failure(self):
- self.open('https://xkcd.com/554/')
+ self.goto('https://xkcd.com/554/')
print('\nCreating baseline in "visual_baseline" folder.')
self.check_window(name="xkcd_554", baseline=True)
# Change height: (83 -> 130) , Change width: (185 -> 120)
diff --git a/examples/visual_testing/layout_test.py b/examples/visual_testing/layout_test.py
index 1a6f1273af2..bfd81e5b960 100644
--- a/examples/visual_testing/layout_test.py
+++ b/examples/visual_testing/layout_test.py
@@ -5,12 +5,12 @@
class VisualLayoutTests(BaseCase):
def test_xkcd_layout_change(self):
self.demo_mode = False # (It would interfere with html comparisons)
- self.open("https://xkcd.com/1424/")
+ self.goto("https://xkcd.com/1424/")
print('\nCreating baseline in "visual_baseline" folder.')
self.sleep(0.08)
self.check_window(name="xkcd", baseline=True)
# Go to a different comic
- self.open("https://xkcd.com/1425/")
+ self.goto("https://xkcd.com/1425/")
# Verify html tags match the baseline
self.check_window(name="xkcd", level=1)
# Verify html tags and attribute names match the baseline
diff --git a/examples/visual_testing/python_home_test.py b/examples/visual_testing/python_home_test.py
index 4ee0b86f51f..f73d716d9fe 100644
--- a/examples/visual_testing/python_home_test.py
+++ b/examples/visual_testing/python_home_test.py
@@ -4,7 +4,7 @@
class VisualLayoutTests(BaseCase):
def test_python_home_layout_change(self):
- self.open("https://python.org/")
+ self.goto("https://python.org/")
print('\nCreating baseline in "visual_baseline" folder.')
self.check_window(name="python_home", baseline=True)
# Remove the "Donate" button
diff --git a/examples/visual_testing/test_layout_fail.py b/examples/visual_testing/test_layout_fail.py
index 284a4e45676..32dbe11d783 100644
--- a/examples/visual_testing/test_layout_fail.py
+++ b/examples/visual_testing/test_layout_fail.py
@@ -5,7 +5,7 @@
class VisualLayout_FixtureTests:
def test_python_home_change(self, sb):
- sb.open("https://python.org/")
+ sb.goto("https://python.org/")
print('\nCreating baseline in "visual_baseline" folder.')
sb.check_window(name="python_home", baseline=True)
# Remove the "Donate" button
@@ -16,7 +16,7 @@ def test_python_home_change(self, sb):
class VisualLayoutFailureTests(BaseCase):
def test_xkcd_logo_change(self):
- self.open("https://xkcd.com/554/")
+ self.goto("https://xkcd.com/554/")
print('\nCreating baseline in "visual_baseline" folder.')
self.check_window(name="xkcd_554", baseline=True)
# Change height: (83 -> 110) , Change width: (185 -> 120)
diff --git a/examples/visual_testing/xkcd_visual_test.py b/examples/visual_testing/xkcd_visual_test.py
index bfbc5961b82..0f8a37d8333 100644
--- a/examples/visual_testing/xkcd_visual_test.py
+++ b/examples/visual_testing/xkcd_visual_test.py
@@ -4,7 +4,7 @@
class VisualLayoutTests(BaseCase):
def test_xkcd_layout_change(self):
- self.open("https://xkcd.com/554/")
+ self.goto("https://xkcd.com/554/")
print('\nCreating baseline in "visual_baseline" folder.')
self.check_window(name="xkcd_554", baseline=True)
# Change height: (83 -> 130) , Change width: (185 -> 120)
diff --git a/examples/wordle_test.py b/examples/wordle_test.py
index ef22cfe8792..cba91744a01 100644
--- a/examples/wordle_test.py
+++ b/examples/wordle_test.py
@@ -51,9 +51,9 @@ def modify_word_list(self, word, letter_status):
def test_wordle(self):
if self.headless:
- self.open_if_not_url("about:blank")
+ self.goto_if_not_url("about:blank")
self.skip("Skip this test in headless mode!")
- self.open("https://www.nytimes.com/games/wordle/index.html")
+ self.goto("https://www.nytimes.com/games/wordle/index.html")
self.click_if_visible("button.purr-blocker-card__button", timeout=2)
self.click_if_visible('button:contains("Play")', timeout=2)
self.click_if_visible('svg[data-testid="icon-close"]', timeout=2)
diff --git a/examples/xpath_test.py b/examples/xpath_test.py
index 7efc76c123b..73da88eaef9 100644
--- a/examples/xpath_test.py
+++ b/examples/xpath_test.py
@@ -5,7 +5,7 @@
class XPathTests(BaseCase):
def test_xpath(self):
- self.open("https://seleniumbase.io/demo_page")
+ self.goto("https://seleniumbase.io/demo_page")
self.assert_element('//h1[(text()="Demo Page")]')
self.type('//*[@id="myTextInput"]', "XPath Test!")
self.click('//button[starts-with(text(),"Click Me")]')
diff --git a/examples/youtube_search_test.py b/examples/youtube_search_test.py
index 893db14f530..64ea6a8adc5 100644
--- a/examples/youtube_search_test.py
+++ b/examples/youtube_search_test.py
@@ -6,10 +6,10 @@ class YouTubeSearchTests(BaseCase):
def test_youtube_autocomplete_results(self):
"""Verify YouTube autocomplete search results."""
if self.headless or self.browser == "safari":
- 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://www.youtube.com/c/MichaelMintz")
+ self.goto("https://www.youtube.com/c/MichaelMintz")
search_term = "seleniumbase"
search_selector = 'input[name="search_query"]'
results_selector = '[role="listbox"]'
diff --git a/help_docs/cdp_mode_methods.md b/help_docs/cdp_mode_methods.md
index ed2a65bec96..a50b42c03fd 100644
--- a/help_docs/cdp_mode_methods.md
+++ b/help_docs/cdp_mode_methods.md
@@ -220,7 +220,7 @@ from seleniumbase import sb_cdp
sb = sb_cdp.Chrome(url=None, **kwargs)
```
-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):
@@ -233,7 +233,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))
@@ -255,10 +255,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.
--------
diff --git a/help_docs/customizing_test_runs.md b/help_docs/customizing_test_runs.md
index a28bbc19050..05f7b11dc6e 100644
--- a/help_docs/customizing_test_runs.md
+++ b/help_docs/customizing_test_runs.md
@@ -879,7 +879,7 @@ platform: Optional[str] = None # Set the Platform. Eg: "MacIntel"
Example: [SeleniumBase/examples/cdp_mode/raw_geolocation_sb.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/raw_geolocation_sb.py)
-Note that if CDP Mode is already active, the options above can also be used when calling `sb.cdp.open()`. (The `url` arg is required in this case.)
+Note that if CDP Mode is already active, the options above can also be used when calling `sb.cdp.goto()`. (The `url` arg is required in this case.)
--------
diff --git a/help_docs/how_it_works.md b/help_docs/how_it_works.md
index 2b78c0cfff4..4c0fff154e0 100644
--- a/help_docs/how_it_works.md
+++ b/help_docs/how_it_works.md
@@ -39,7 +39,7 @@ class MyTestClass(BaseCase):
```python
class MyTestClass(BaseCase):
def test_abc(self):
- self.open("https://example.com")
+ self.goto("https://example.com")
```
👁️🔎 Here's what a full test might look like:
@@ -50,7 +50,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")')
@@ -80,7 +80,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")')
diff --git a/help_docs/html_inspector.md b/help_docs/html_inspector.md
index 5c0c98206cc..b448fb25eed 100644
--- a/help_docs/html_inspector.md
+++ b/help_docs/html_inspector.md
@@ -14,11 +14,11 @@ BaseCase.main(__name__, __file__)
class HtmlInspectorTests(BaseCase):
def test_html_inspector(self):
- self.open("https://xkcd.com/1144/")
+ self.goto("https://xkcd.com/1144/")
self.inspect_html()
```
---------
+----
```zsh
pytest test_inspect_html.py
diff --git a/help_docs/js_package_manager.md b/help_docs/js_package_manager.md
index 8dbdfda2800..695936f3a81 100644
--- a/help_docs/js_package_manager.md
+++ b/help_docs/js_package_manager.md
@@ -34,7 +34,7 @@ pytest maps_introjs_tour.py --interval=1
🗺️ Here is some tour code in Python from maps_introjs_tour.py that expands into a lot of JavaScript.
```python
-self.open("https://www.google.com/maps/@42.3591234,-71.0915634,15z")
+self.goto("https://www.google.com/maps/@42.3591234,-71.0915634,15z")
self.create_tour(theme="introjs")
self.add_tour_step("Welcome to Google Maps!", title="SeleniumBase Tours")
self.add_tour_step("Enter Location", "#searchboxinput", title="Search Box")
diff --git a/help_docs/method_summary.md b/help_docs/method_summary.md
index ae72d8d3c67..11b2a535fe6 100644
--- a/help_docs/method_summary.md
+++ b/help_docs/method_summary.md
@@ -10,11 +10,11 @@ Here's a list of SeleniumBase method definitions, which are defined in **[base_c
For backwards compatibility, older versions of method names have remained to keep older scripts working. *(E.g: wait_for_element_visible was shortened to wait_for_element and then to find_element.)*
```python
-self.open(url)
+self.goto(url)
# Duplicates: self.open_url(url), self.visit(url), visit_url(url),
-# self.goto(url), self.go_to(url)
+# self.open(url), self.go_to(url)
self.get(url)
-# If the url parameter is a URL: Perform self.open(url)
+# If the url parameter is a URL: Perform self.goto(url)
# Otherwise: return self.get_element(URL_AS_A_SELECTOR)
self.click(selector, by="css selector", timeout=None, delay=0, scroll=True)
self.slow_click(selector, by="css selector", timeout=None)
@@ -48,8 +48,10 @@ self.get_user_agent()
self.get_locale_code()
self.go_back()
self.go_forward()
-self.open_start_page()
-self.open_if_not_url(url)
+self.goto_start_page()
+# Duplicates: self.open_start_page()
+self.goto_if_not_url(url)
+# Duplicates: self.open_if_not_url()
self.is_element_present(selector, by="css selector")
self.is_element_visible(selector, by="css selector")
self.is_element_clickable(selector, by="css selector")
@@ -703,8 +705,8 @@ self.uc_gui_handle_captcha(frame="iframe")
# "driver"-specific methods added (or modified) by SeleniumBase
driver.default_get(url) # Because driver.get(url) works differently in UC Mode
-driver.open(url) # Like driver.get(), but allows partial URLs without protocol
-driver.goto(url) # Same as driver.open(url)
+driver.goto(url) # Like driver.get(), but allows partial URLs without protocol
+driver.open(url) # Same as driver.goto(url)
driver.click(selector)
driver.click_link(link_text)
driver.click_if_visible(selector)
diff --git a/help_docs/mobile_testing.md b/help_docs/mobile_testing.md
index 9a5ba023d47..36c6c1831bb 100644
--- a/help_docs/mobile_testing.md
+++ b/help_docs/mobile_testing.md
@@ -66,7 +66,7 @@ from seleniumbase import Driver
driver = Driver(mobile=True)
try:
- driver.open("https://www.roblox.com/")
+ driver.goto("https://www.roblox.com/")
driver.assert_element("#download-the-app-container")
driver.assert_text("Roblox for Android")
driver.highlight('span:contains("Roblox for Android")', loops=8)
diff --git a/help_docs/recorder_mode.md b/help_docs/recorder_mode.md
index 59c756c0ec9..7651203aa94 100644
--- a/help_docs/recorder_mode.md
+++ b/help_docs/recorder_mode.md
@@ -113,13 +113,13 @@ pytest TEST_NAME.py --trace --rec -s
⏺️ Recorder Mode works by saving your recorded actions into the browser's sessionStorage. SeleniumBase then reads from the browser's sessionStorage to take the raw data and generate a full test from it. Keep in mind that sessionStorage is only present while the browser tab remains in the same domain/origin. (The sessionStorage of that tab goes away if you leave that domain/origin.) To compensate, links to web pages of different domain/origin will automatically open a new tab for you in Recorder Mode.
-⏺️ Additionally, the SeleniumBase self.open(URL) method will also open a new tab for you in Recorder Mode if the domain/origin is different from the current URL. If you need to navigate to a different domain/origin from within the same tab, call self.save_recorded_actions() first, which saves the recorded data for later. When a recorded test completes, SeleniumBase scans the sessionStorage data of all open browser tabs for generating the completed script.
+⏺️ Additionally, the SeleniumBase self.goto(URL) method will also open a new tab for you in Recorder Mode if the domain/origin is different from the current URL. If you need to navigate to a different domain/origin from within the same tab, call self.save_recorded_actions() first, which saves the recorded data for later. When a recorded test completes, SeleniumBase scans the sessionStorage data of all open browser tabs for generating the completed script.
⏺️ As an alternative to activating Recorder Mode with the --rec command-line arg, you can also call self.activate_recorder() from your tests. Using the Recorder this way is only useful for tests that stay on the same URL. This is because the standard Recorder Mode functions as a Chrome extension and persists wherever the browser goes. (This version only stays on the page where called.)
⏺️ (Note that same domain/origin is not the same as same URL. Example: https://xkcd.com/353 and https://xkcd.com/1537 are two different URLs with the same domain/origin. That means both URLs share the same sessionStorage, and that changes persist to different URLs of the same domain/origin. If you want to find out a website's origin during a test, just call: self.get_origin(), which returns the value of window.location.origin from the browser's console.)
-⏺️ Inside recorded tests, you might find the self.open_if_not_url(URL) method, which opens the URL given if the browser is not currently on that page. SeleniumBase uses this method in recorded scripts when the Recorder detects that a browser action changed the current URL. This method prevents an unnecessary page load and shows what page the test visited after a browser action.
+⏺️ Inside recorded tests, you might find the self.goto_if_not_url(url) method, which opens the URL given if the browser is not currently on that page. SeleniumBase uses this method in recorded scripts when the Recorder detects that a browser action changed the current URL. This method prevents an unnecessary page load and shows what page the test visited after a browser action.
⏺️ By launching the Recorder App with sbase recorder --ee, you can end the recording by pressing {SHIFT+ESC} instead of the usual way of ending the recording by typing c from a breakpoint() and pressing Enter. Those buttons don't need to be pressed at the same time, but SHIFT must be pressed directly before ESC.
diff --git a/help_docs/syntax_formats.md b/help_docs/syntax_formats.md
index c1181df1abc..311233d174a 100644
--- a/help_docs/syntax_formats.md
+++ b/help_docs/syntax_formats.md
@@ -52,7 +52,7 @@ BaseCase.main(__name__, __file__)
class MyTestClass(BaseCase):
def test_demo_site(self):
- self.open("https://seleniumbase.io/demo_page")
+ self.goto("https://seleniumbase.io/demo_page")
self.type("#myTextInput", "This is Automated")
self.click("#myButton")
self.assert_element("tbody#tbodyId")
@@ -123,7 +123,7 @@ from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
def test_sb_fixture_with_no_class(sb: BaseCase):
- sb.open("seleniumbase.io/help_docs/install/")
+ sb.goto("seleniumbase.io/help_docs/install/")
sb.type('input[aria-label="Search"]', "GUI Commander")
sb.click('mark:contains("Commander")')
sb.assert_title_contains("GUI / Commander")
@@ -142,7 +142,7 @@ BaseCase.main(__name__, __file__)
class Test_SB_Fixture:
def test_sb_fixture_inside_class(self, sb: BaseCase):
- sb.open("seleniumbase.io/help_docs/install/")
+ sb.goto("seleniumbase.io/help_docs/install/")
sb.type('input[aria-label="Search"]', "GUI Commander")
sb.click('mark:contains("Commander")')
sb.assert_title_contains("GUI / Commander")
@@ -161,7 +161,7 @@ BaseCase.main(__name__, __file__)
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"]')
@@ -186,7 +186,7 @@ BaseCase.main(__name__, __file__)
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"]')
@@ -213,7 +213,7 @@ BaseCase.main(__name__, __file__)
def test_request_sb_fixture(request):
sb: BaseCase = request.getfixturevalue("sb")
- sb.open("https://seleniumbase.io/demo_page")
+ sb.goto("https://seleniumbase.io/demo_page")
sb.assert_text("SeleniumBase", "#myForm h2")
sb.assert_element("input#myTextInput")
sb.type("#myTextarea", "This is me")
@@ -235,7 +235,7 @@ BaseCase.main(__name__, __file__)
class Test_Request_Fixture:
def test_request_sb_fixture_in_class(self, request):
sb: BaseCase = request.getfixturevalue("sb")
- sb.open("https://seleniumbase.io/demo_page")
+ sb.goto("https://seleniumbase.io/demo_page")
sb.assert_element("input#myTextInput")
sb.type("#myTextarea", "Automated")
sb.assert_text("This Text is Green", "#pText")
@@ -276,7 +276,7 @@ class OverrideDriverTest(BaseCase):
return webdriver.Chrome(options=options)
def test_simple(self):
- self.open("https://seleniumbase.io/demo_page")
+ self.goto("https://seleniumbase.io/demo_page")
self.assert_text("Demo Page", "h1")
```
@@ -351,12 +351,12 @@ def sb(request):
sb._needs_tearDown = False
def test_override_fixture_no_class(sb: BaseCase):
- sb.open("https://seleniumbase.io/demo_page")
+ sb.goto("https://seleniumbase.io/demo_page")
sb.type("#myTextInput", "This is Automated")
class TestOverride:
def test_override_fixture_inside_class(self, sb: BaseCase):
- sb.open("https://seleniumbase.io/demo_page")
+ sb.goto("https://seleniumbase.io/demo_page")
sb.type("#myTextInput", "This is Automated")
```
@@ -732,7 +732,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()
@step("Login to Swag Labs with {user}")
@@ -753,7 +753,7 @@ This format provides a pure Python way of using SeleniumBase without a test runn
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")')
@@ -772,13 +772,13 @@ Here's another example, which uses test mode:
from seleniumbase import SB
with SB(uc=True, test=True) as sb:
- sb.open("https://google.com/ncr")
+ sb.goto("https://google.com/ncr")
sb.type('[name="q"]', "SeleniumBase on GitHub\n")
sb.highlight('a[href*="github.com/seleniumbase"]')
sb.sleep(0.5)
with SB(test=True, rtf=True, demo=True) as sb:
- sb.open("seleniumbase.github.io/demo_page")
+ sb.goto("seleniumbase.github.io/demo_page")
sb.type("#myTextInput", "This is Automated")
sb.assert_text("This is Automated", "#myTextInput")
sb.assert_text("This Text is Green", "#pText")
@@ -818,18 +818,18 @@ This pure Python format gives you a raw webdriver in
from seleniumbase import DriverContext
with DriverContext() as driver:
- driver.open("seleniumbase.io/")
+ driver.goto("seleniumbase.io/")
driver.highlight('img[alt="SeleniumBase"]', loops=6)
with DriverContext(browser="chrome", incognito=True) as driver:
- driver.open("seleniumbase.io/apps/calculator")
+ driver.goto("seleniumbase.io/apps/calculator")
driver.click('[id="4"]')
driver.click('[id="2"]')
driver.assert_text("42", "#output")
driver.highlight("#output", loops=6)
with DriverContext() as driver:
- driver.open("seleniumbase.io/demo_page")
+ driver.goto("seleniumbase.io/demo_page")
driver.highlight("h2")
driver.type("#myTextInput", "Automation")
driver.click("#checkBox1")
@@ -849,7 +849,7 @@ from seleniumbase import Driver
driver = Driver()
try:
- driver.open("seleniumbase.io/demo_page")
+ driver.goto("seleniumbase.io/demo_page")
driver.highlight("h2")
driver.type("#myTextInput", "Automation")
driver.click("#checkBox1")
@@ -859,7 +859,7 @@ finally:
driver = Driver(browser="chrome", headless=False)
try:
- driver.open("seleniumbase.io/apps/calculator")
+ driver.goto("seleniumbase.io/apps/calculator")
driver.click('[id="4"]')
driver.click('[id="2"]')
driver.assert_text("42", "#output")
@@ -877,7 +877,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")')
@@ -920,7 +920,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()
@@ -951,7 +951,7 @@ for nav_item in links:
print(nav_item.text)
sb.click_link("Sign out")
sb.assert_text("signed out", "#top_message")
-sb.driver.stop()
+sb.quit()
```
(See examples/cdp_mode/raw_basic_cdp.py for the test.)
@@ -989,7 +989,7 @@ def main():
cards = sb.select_all('span[data-automation*="product-list-card"]')
for card in cards:
print("* %s" % card.text)
- sb.driver.stop()
+ sb.quit()
if __name__ == "__main__":
main()
diff --git a/integrations/behave/ReadMe.md b/integrations/behave/ReadMe.md
index d0ac89bb84c..39cf9e0bd51 100644
--- a/integrations/behave/ReadMe.md
+++ b/integrations/behave/ReadMe.md
@@ -119,7 +119,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/integrations/behave/features/steps/calculator.py b/integrations/behave/features/steps/calculator.py
index 885b3f8922e..cd0926c58ea 100644
--- a/integrations/behave/features/steps/calculator.py
+++ b/integrations/behave/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/integrations/behave/features/steps/fail_page.py b/integrations/behave/features/steps/fail_page.py
index 2525a61a332..3761c50a07e 100644
--- a/integrations/behave/features/steps/fail_page.py
+++ b/integrations/behave/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/integrations/behave/features/steps/real_world.py b/integrations/behave/features/steps/real_world.py
index 970d910020c..f349cbadec7 100644
--- a/integrations/behave/features/steps/real_world.py
+++ b/integrations/behave/features/steps/real_world.py
@@ -4,7 +4,7 @@
@step("Open the RealWorld Login Page")
def go_to_realworld(context):
sb = context.sb
- context.sb.open("https://seleniumbase.io/realworld/login")
+ context.sb.goto("https://seleniumbase.io/realworld/login")
sb.clear_session_storage()
diff --git a/integrations/behave/features/steps/swag_labs.py b/integrations/behave/features/steps/swag_labs.py
index feb31340f6b..189b6f4f758 100644
--- a/integrations/behave/features/steps/swag_labs.py
+++ b/integrations/behave/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/integrations/node_js/my_first_test.py b/integrations/node_js/my_first_test.py
index 24e97dbd404..68875df12a7 100644
--- a/integrations/node_js/my_first_test.py
+++ b/integrations/node_js/my_first_test.py
@@ -3,7 +3,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("#inventory_container")
diff --git a/integrations/node_js/test_demo_site.py b/integrations/node_js/test_demo_site.py
index 610d3d2582c..cf9964c984c 100644
--- a/integrations/node_js/test_demo_site.py
+++ b/integrations/node_js/test_demo_site.py
@@ -5,7 +5,7 @@
class DemoSiteTests(BaseCase):
def test_demo_site(self):
# Open a web page in the active browser window
- self.open("https://seleniumbase.io/demo_page")
+ self.goto("https://seleniumbase.io/demo_page")
# Assert the title of the current web page
self.assert_title("Web Testing Page")
diff --git a/requirements.txt b/requirements.txt
index cd44d8637c5..b74d834454c 100755
--- a/requirements.txt
+++ b/requirements.txt
@@ -66,7 +66,7 @@ pytest-xdist==3.8.0
parameterized==0.9.0
behave==1.2.6
soupsieve~=2.8.4
-beautifulsoup4~=4.14.3
+beautifulsoup4~=4.15.0
pyotp==2.9.0
python-xlib==0.33;platform_system=="Linux"
PyAutoGUI>=0.9.54;platform_system=="Linux"
diff --git a/sbase/steps.py b/sbase/steps.py
index e1d9f986d89..7525686fa00 100644
--- a/sbase/steps.py
+++ b/sbase/steps.py
@@ -21,7 +21,7 @@ def normalize_text(text):
@step('User goes to URL "{url}"')
def open_url(context, url):
sb = context.sb
- sb.open(url)
+ sb.goto(url)
@step("Click '{selector}'")
diff --git a/seleniumbase/__version__.py b/seleniumbase/__version__.py
index 8583dc6ac3f..3e26bcb4d14 100755
--- a/seleniumbase/__version__.py
+++ b/seleniumbase/__version__.py
@@ -1,2 +1,2 @@
# seleniumbase package
-__version__ = "4.49.7"
+__version__ = "4.49.8"
diff --git a/seleniumbase/config/settings.py b/seleniumbase/config/settings.py
index c0980f01f02..15b32fbadb5 100644
--- a/seleniumbase/config/settings.py
+++ b/seleniumbase/config/settings.py
@@ -70,7 +70,7 @@
These methods add global waits, such as self.wait_for_ready_state_complete(),
which waits for document.readyState to be "complete" after browser 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/seleniumbase/console_scripts/run.py b/seleniumbase/console_scripts/run.py
index c97050967c9..60fc9a7a2d8 100644
--- a/seleniumbase/console_scripts/run.py
+++ b/seleniumbase/console_scripts/run.py
@@ -293,9 +293,9 @@ def show_mkfile_usage():
print(" If the file already exists, an error is raised.")
print(" By default, uses English with BaseCase inheritance,")
print(" and creates a boilerplate with common SeleniumBase")
- print(' methods: "open", "type", "click", "assert_element",')
+ print(' methods: "goto", "type", "click", "assert_element",')
print(' and "assert_text". If using the basic boilerplate')
- print(' option, only the "open" method is included. Only the')
+ print(' option, only the "goto" method is included. Only the')
print(" BaseCase format supports Languages or Recorder Mode.")
print(" UC Mode automatically uses English with SB() format.")
print("")
@@ -737,7 +737,7 @@ def show_methods():
print(line)
print("")
sbm = ""
- sbm += "*.open(url) => Navigate the browser window to the URL.\n"
+ sbm += "*.goto(url) => Navigate the browser window to the URL.\n"
sbm += "*.type(selector, text) => Update the field with the text.\n"
sbm += "*.click(selector) => Click the element with the selector.\n"
sbm += "*.click_link(link_text) => Click the link containing text.\n"
diff --git a/seleniumbase/console_scripts/sb_mkdir.py b/seleniumbase/console_scripts/sb_mkdir.py
index d843e921748..67fa4e49e43 100644
--- a/seleniumbase/console_scripts/sb_mkdir.py
+++ b/seleniumbase/console_scripts/sb_mkdir.py
@@ -413,7 +413,7 @@ def main():
data.append("")
data.append("class MyTestClass(BaseCase):")
data.append(" def test_swag_labs(self):")
- data.append(' self.open("https://www.saucedemo.com")')
+ data.append(' self.goto("https://www.saucedemo.com")')
data.append(' self.type("#user-name", "standard_user")')
data.append(' self.type("#password", "secret_sauce\\n")')
data.append(' self.assert_element("div.inventory_list")')
@@ -449,7 +449,7 @@ def main():
data.append("")
data.append("class DemoSiteTests(BaseCase):")
data.append(" def test_demo_site(self):")
- data.append(' self.open("https://seleniumbase.io/demo_page.html")')
+ data.append(' self.goto("https://seleniumbase.io/demo_page.html")')
data.append(' self.assert_title("Web Testing Page")')
data.append(' self.assert_element("tbody#tbodyId")')
data.append(' self.assert_text("Demo Page", "h1")')
@@ -561,7 +561,7 @@ def main():
"self, search_term, keyword, title_text):"
)
data.append(
- ' self.open("https://seleniumbase.io/help_docs/how_it_works/")'
+ ' self.goto("https://seleniumbase.io/help_docs/how_it_works/")'
)
data.append(
' self.type(\'[aria-label="Search"]\', search_term)'
@@ -652,7 +652,7 @@ def main():
data.append("")
data.append("class DataPage:")
data.append(" def go_to_data_url(self, sb):")
- data.append(' sb.open("data:text/html,