Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmintz committed Mar 9, 2024
1 parent f1c91d8 commit 516d9b2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/raw_bing_captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
sb.activate_demo_mode() # See asserts as they happen
sb.assert_element("svg#success-icon")
sb.assert_text("Success!", "span#success-text")
sb.highlight("div#success", loops=10)
sb.highlight("div#success")
4 changes: 3 additions & 1 deletion examples/raw_cdp_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

driver = Driver(uc=True, log_cdp=True)
try:
driver.get("https://seleniumbase.io/apps/invisible_recaptcha")
driver.uc_open_with_reconnect("https://seleniumbase.io/apps/turnstile")
driver.uc_switch_to_frame("iframe")
driver.uc_click("span.mark")
driver.sleep(3)
pprint(driver.get_log("performance"))
finally:
Expand Down
7 changes: 4 additions & 3 deletions examples/raw_nopecha.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from seleniumbase import SB

with SB(uc=True, test=True) as sb:
sb.driver.uc_open_with_reconnect("https://nopecha.com/demo/turnstile", 5)
sb.driver.uc_open_with_reconnect("https://nopecha.com/demo/turnstile", 4)
sb.driver.uc_switch_to_frame("#example-container5 iframe")
sb.driver.uc_click("span.mark")
sb.driver.uc_click("span.mark", reconnect_time=1)

if sb.is_element_visible("#example-container0 iframe"):
sb.switch_to_frame("#example-container0 iframe")
if not sb.is_element_visible("circle.success-circle"):
sb.driver.uc_click("span.mark")
sb.driver.uc_click("span.mark", reconnect_time=1)
sb.switch_to_frame("#example-container0 iframe")
sb.assert_element("circle.success-circle")
sb.switch_to_parent_frame()

sb.switch_to_frame("#example-container5 iframe")
sb.assert_element("svg#success-icon", timeout=3)
sb.switch_to_parent_frame()
Expand Down
17 changes: 17 additions & 0 deletions examples/raw_robot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from seleniumbase import SB

with SB(enable_3d_apis=True, test=True) as sb:
sb.open("threejs.org/examples/#webgl_animation_skinning_morph")
sb.switch_to_frame("iframe#viewer")
sb.set_text_content("#info p", "Hi, I'm Michael Mintz")
sb.add_css_style("#info p{zoom: 2.54}")
sb.sleep(0.8)
sb.click('button:contains("Wave")')
sb.highlight("#info p")
sb.select_option_by_text("select", "Idle")
sb.click('button:contains("ThumbsUp")')
sb.set_text_content("#info p", "I created SeleniumBase")
sb.highlight("#info p")
sb.sleep(0.8)
sb.click('button:contains("Jump")')
sb.sleep(1.5)
4 changes: 3 additions & 1 deletion examples/raw_uc_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
if not sb.is_text_visible("Username", '[for="user_login"]'):
sb.driver.uc_open_with_reconnect(url, 4)
sb.assert_text("Username", '[for="user_login"]', timeout=3)
sb.highlight('label[for="user_login"]', loops=3)
sb.assert_element('label[for="user_login"]')
sb.highlight('button:contains("Sign in")')
sb.highlight('h1:contains("GitLab.com")')
sb.post_message("SeleniumBase wasn't detected", duration=4)
2 changes: 1 addition & 1 deletion examples/test_3d_apis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
BaseCase.main(__name__, __file__, "--enable-3d-apis")


class ThreeJSTests(BaseCase):
Expand Down

0 comments on commit 516d9b2

Please sign in to comment.