SeleniumBase/examples/raw_driver_manager.py

23 lines
618 B
Python
Raw Normal View History

2024-02-23 13:18:46 +08:00
"""Driver() manager example. (Runs with "python")."""
2022-10-20 12:02:55 +08:00
from seleniumbase import Driver
2024-02-23 13:18:46 +08:00
driver = Driver()
try:
driver.open("seleniumbase.io/demo_page")
driver.highlight("h2")
driver.type("#myTextInput", "Automation")
driver.click("#checkBox1")
driver.highlight("img", loops=6)
finally:
driver.quit()
2022-10-20 12:02:55 +08:00
driver = Driver(browser="chrome", headless=False)
try:
2023-09-25 04:49:58 +08:00
driver.open("seleniumbase.io/apps/calculator")
2023-09-10 11:43:07 +08:00
driver.click('[id="4"]')
driver.click('[id="2"]')
driver.assert_text("42", "#output")
driver.highlight("#output", loops=6)
finally:
driver.quit()