-
from seleniumbase import SB with SB(uc=True) as sb: |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
The official Page Object Model formats with SeleniumBase are: Syntax Format 5 - with the from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
class LoginPage:
def login_to_swag_labs(self, sb, username):
sb.open("https://www.saucedemo.com")
sb.type("#user-name", username)
sb.type("#password", "secret_sauce")
sb.click('input[type="submit"]')
class MyTests(BaseCase):
def test_swag_labs_login(self):
LoginPage().login_to_swag_labs(self, "standard_user")
self.assert_element("div.inventory_list")
self.assert_element('div:contains("Sauce Labs Backpack")') and Syntax Format 6 with the class LoginPage:
def login_to_swag_labs(self, sb, username):
sb.open("https://www.saucedemo.com")
sb.type("#user-name", username)
sb.type("#password", "secret_sauce")
sb.click('input[type="submit"]')
class MyTests:
def test_swag_labs_login(self, sb):
LoginPage().login_to_swag_labs(sb, "standard_user")
sb.assert_element("div.inventory_list")
sb.assert_element('div:contains("Sauce Labs Backpack")') |
Beta Was this translation helpful? Give feedback.
-
how i can use [Syntax Format 5] on Jupyter i get |
Beta Was this translation helpful? Give feedback.
-
and this OutOfScopeException Traceback (most recent call last) e:\programme\anaconda3\envs\seleniumbase\Lib\site-packages\seleniumbase\fixtures\base_case.py in ?(self, browser, headless, locale_code, protocol, servername, port, proxy, proxy_bypass_list, proxy_pac_url, multi_proxy, agent, switch_to, cap_file, cap_string, recorder_ext, disable_js, disable_csp, enable_ws, enable_sync, use_auto_ext, undetectable, uc_cdp_events, uc_subprocess, log_cdp_events, no_sandbox, disable_gpu, headless2, incognito, guest_mode, dark_mode, devtools, remote_debug, enable_3d_apis, swiftshader, ad_block_on, host_resolver_rules, block_images, do_not_track, chromium_arg, firefox_arg, firefox_pref, user_data_dir, extension_zip, extension_dir, disable_features, binary_location, driver_version, page_load_strategy, use_wire, external_pdf, is_mobile, d_width, d_height, d_p_r) e:\programme\anaconda3\envs\seleniumbase\Lib\site-packages\seleniumbase\fixtures\base_case.py in ?(self) |
Beta Was this translation helpful? Give feedback.
-
Use the syntax exactly as written in #2494 (comment) |
Beta Was this translation helpful? Give feedback.
-
yes i uses the same |
Beta Was this translation helpful? Give feedback.
The official Page Object Model formats with SeleniumBase are:
Syntax Format 5 - with the
BaseCase
format:and Syntax Format 6 with the
pytest
fixture:c…