Skip to content

Commit dd64418

Browse files
committed
Add an example that can be run with pure "python"
1 parent 27bd33b commit dd64418

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

examples/raw_browser_launcher.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
This script can be run with pure "python". (pytest not needed).
3+
"get_driver()" is from [seleniumbase/core/browser_launcher.py].
4+
"""
5+
from seleniumbase import get_driver
6+
from seleniumbase import js_utils
7+
from seleniumbase import page_actions
8+
9+
success = False
10+
try:
11+
driver = get_driver("chrome", headless=False)
12+
driver.get('data:text/html,<h1 class="top">Data URL</h2>')
13+
source = driver.page_source
14+
assert "Data URL" in source
15+
# An example of "is_element_visible()" from "page_actions"
16+
assert page_actions.is_element_visible(driver, "h1.top")
17+
# Extra fun with Javascript
18+
js_utils.highlight_with_js(driver, "h1.top", 8, "")
19+
success = True # No errors
20+
finally:
21+
driver.quit()
22+
assert success

0 commit comments

Comments
 (0)