|
1 | 1 | """Can run with "python". (pytest not needed).""" |
2 | | -from seleniumbase import js_utils |
3 | | -from seleniumbase import page_actions |
4 | 2 | from seleniumbase import DriverContext |
5 | 3 |
|
6 | | -# Driver Context Manager - (By default, browser="chrome". Lots of options) |
7 | 4 | with DriverContext() as driver: |
8 | 5 | driver.get("https://seleniumbase.github.io/") |
9 | | - js_utils.highlight_with_js(driver, 'img[alt="SeleniumBase"]', loops=6) |
| 6 | + driver.highlight('img[alt="SeleniumBase"]', loops=6) |
10 | 7 |
|
11 | 8 | with DriverContext(browser="chrome", incognito=True) as driver: |
12 | 9 | driver.get("https://seleniumbase.io/apps/calculator") |
13 | | - page_actions.wait_for_element(driver, '[id="4"]').click() |
14 | | - page_actions.wait_for_element(driver, '[id="2"]').click() |
15 | | - page_actions.wait_for_text(driver, "42", "#output") |
16 | | - js_utils.highlight_with_js(driver, "#output", loops=6) |
| 10 | + driver.click('[id="4"]') |
| 11 | + driver.click('[id="2"]') |
| 12 | + driver.assert_text("42", "#output") |
| 13 | + driver.highlight("#output", loops=6) |
17 | 14 |
|
18 | 15 | with DriverContext() as driver: |
19 | 16 | driver.get("https://seleniumbase.github.io/demo_page") |
20 | | - js_utils.highlight_with_js(driver, "h2", loops=5) |
21 | | - by_css = "css selector" |
22 | | - driver.find_element(by_css, "#myTextInput").send_keys("Automation") |
23 | | - driver.find_element(by_css, "#checkBox1").click() |
24 | | - js_utils.highlight_with_js(driver, "img", loops=5) |
| 17 | + driver.highlight("h2") |
| 18 | + driver.type("#myTextInput", "Automation") |
| 19 | + driver.click("#checkBox1") |
| 20 | + driver.highlight("img", loops=6) |
0 commit comments