How to override Chromedriver #2310
-
I've been added to a QA team that has a test project that uses the selenium(arm)/standalone-chromium image to run their UI tests. I would like to use SB, but I'm having trouble getting SB to run with their existing Chromedriver. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
SeleniumBase automatically takes care of driver management. All you have to do is decide on the syntax format that you want to use from SeleniumBase/help_docs/syntax_formats.md. For example, the from seleniumbase import SB
with SB() as sb:
sb.open("seleniumbase.io/simple/login")
sb.type("#username", "demo_user")
sb.type("#password", "secret_pass")
sb.click('a:contains("Sign in")')
sb.assert_exact_text("Welcome!", "h1")
sb.assert_element("img#image1")
sb.highlight("#image1")
sb.click_link("Sign out")
sb.assert_text("signed out", "#top_message") Here's a raw driver = Driver()
try:
driver.open("seleniumbase.github.io/demo_page")
driver.highlight("h2")
driver.type("#myTextInput", "Automation")
driver.click("#checkBox1")
driver.highlight("img", loops=6)
finally:
driver.quit() Here's a from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
class TestSimpleLogin(BaseCase):
def test_simple_login(self):
self.open("seleniumbase.io/simple/login")
self.type("#username", "demo_user")
self.type("#password", "secret_pass")
self.click('a:contains("Sign in")')
self.assert_exact_text("Welcome!", "h1")
self.assert_element("img#image1")
self.highlight("#image1")
self.click_link("Sign out")
self.assert_text("signed out", "#top_message") There are lots of command-line options that you can use to change default settings: SeleniumBase/help_docs/customizing_test_runs.md |
Beta Was this translation helpful? Give feedback.
SeleniumBase automatically takes care of driver management. All you have to do is decide on the syntax format that you want to use from SeleniumBase/help_docs/syntax_formats.md.
For example, the
SB()
context manager format:Here's a raw
driver
format: