2023-04-19 13:56:48 +08:00
|
|
|
"""Can run with "python". (pytest not needed)."""
|
2022-11-05 12:21:10 +08:00
|
|
|
from seleniumbase import DriverContext
|
2022-10-14 15:58:18 +08:00
|
|
|
|
2022-11-05 12:21:10 +08:00
|
|
|
with DriverContext() as driver:
|
2023-09-25 04:49:58 +08:00
|
|
|
driver.open("seleniumbase.github.io/")
|
2023-09-10 11:43:07 +08:00
|
|
|
driver.highlight('img[alt="SeleniumBase"]', loops=6)
|
2022-10-14 15:58:18 +08:00
|
|
|
|
2023-01-15 10:32:43 +08:00
|
|
|
with DriverContext(browser="chrome", incognito=True) as driver:
|
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)
|
2023-01-15 10:32:43 +08:00
|
|
|
|
2022-11-05 12:21:10 +08:00
|
|
|
with DriverContext() as driver:
|
2023-09-25 04:49:58 +08:00
|
|
|
driver.open("seleniumbase.github.io/demo_page")
|
2023-09-10 11:43:07 +08:00
|
|
|
driver.highlight("h2")
|
|
|
|
driver.type("#myTextInput", "Automation")
|
|
|
|
driver.click("#checkBox1")
|
|
|
|
driver.highlight("img", loops=6)
|