Update example tests

This commit is contained in:
Michael Mintz 2022-10-21 19:30:58 -04:00
parent 36ab7c8d23
commit f7326aac55
2 changed files with 7 additions and 7 deletions

View File

@ -10,16 +10,16 @@ try:
page_actions.wait_for_element(driver, "4", "id").click()
page_actions.wait_for_element(driver, "2", "id").click()
page_actions.wait_for_text(driver, "42", "output", "id")
js_utils.highlight_with_js(driver, "#output", 6, "")
js_utils.highlight_with_js(driver, "#output", loops=6)
finally:
driver.quit()
# Example 2 using default args or command-line options
driver = Driver()
driver.get("https://seleniumbase.github.io/demo_page")
js_utils.highlight_with_js(driver, "h2", 5, "")
js_utils.highlight_with_js(driver, "h2", loops=5)
by_css = "css selector"
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
driver.find_element(by_css, "#checkBox1").click()
js_utils.highlight_with_js(driver, "img", 5, "")
js_utils.highlight_with_js(driver, "img", loops=5)
driver.quit() # If the script fails early, the driver still quits

View File

@ -6,15 +6,15 @@ from seleniumbase import Driver
# Python Context Manager
with Driver() as driver: # By default, browser="chrome"
driver.get("https://google.com/ncr")
js_utils.highlight_with_js(driver, 'img[alt="Google"]', 6, "")
js_utils.highlight_with_js(driver, 'img[alt="Google"]', loops=6)
with Driver() as driver: # Also accepts command-line options
driver.get("https://seleniumbase.github.io/demo_page")
js_utils.highlight_with_js(driver, "h2", 5, "")
js_utils.highlight_with_js(driver, "h2", loops=5)
by_css = "css selector"
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
driver.find_element(by_css, "#checkBox1").click()
js_utils.highlight_with_js(driver, "img", 5, "")
js_utils.highlight_with_js(driver, "img", loops=5)
# Python Context Manager (with options given)
with Driver(browser="chrome", incognito=True) as driver:
@ -22,4 +22,4 @@ with Driver(browser="chrome", incognito=True) as driver:
page_actions.wait_for_element(driver, "4", "id").click()
page_actions.wait_for_element(driver, "2", "id").click()
page_actions.wait_for_text(driver, "42", "output", "id")
js_utils.highlight_with_js(driver, "#output", 6, "")
js_utils.highlight_with_js(driver, "#output", loops=6)