Skip to content

Commit

Permalink
Merge pull request #2958 from seleniumbase/refresh-dependencies-and-u…
Browse files Browse the repository at this point in the history
…c-mode

Refresh dependencies and UC Mode
  • Loading branch information
mdmintz authored Jul 24, 2024
2 parents 3fbc871 + 3d0d604 commit b8996a6
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 43 deletions.
14 changes: 2 additions & 12 deletions examples/raw_bing_captcha.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
from seleniumbase import SB


with SB(uc=True, test=True) as sb:
url = "https://www.bing.com/turing/captcha/challenge"
sb.driver.uc_open_with_reconnect(url, 1.25)
sb.add_css_style("iframe{zoom: 2}") # Make it bigger
sb.switch_to_frame("iframe")
if not sb.is_element_visible("div#success"):
sb.driver.uc_open_with_reconnect(url, 4.05)
sb.add_css_style("iframe{zoom: 2}")
sb.switch_to_frame("iframe")
sb.highlight("div#success", loops=2)
sb.assert_text("Success!", "span#success-text")
sb.activate_demo_mode() # See asserts as they happen
sb.assert_element("svg#success-icon")
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_captcha()
7 changes: 4 additions & 3 deletions examples/raw_gui_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
agent = None # Use the default UserAgent

with SB(uc=True, test=True, rtf=True, agent=agent) as sb:
url = "https://www.virtualmanager.com/en/login"
url = "https://gitlab.com/users/sign_in"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_cf() # Ready if needed!
sb.assert_element('input[name*="email"]')
sb.assert_element('input[name*="login"]')
sb.assert_element('label[for="user_login"]')
sb.assert_element('input[data-testid*="username"]')
sb.assert_element('input[data-testid*="password"]')
sb.set_messenger_theme(location="bottom_center")
sb.post_message("SeleniumBase wasn't detected!")
17 changes: 4 additions & 13 deletions examples/raw_nopecha.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
from seleniumbase import SB

with SB(uc=True, test=True) as sb:
sb.uc_open_with_disconnect("nopecha.com/demo/turnstile", 3.5)
sb.uc_gui_press_keys("\t\t ")
sb.sleep(3.5)
sb.connect()
sb.uc_gui_handle_cf("#example-container5 iframe")

if sb.is_element_visible("#example-container0 iframe"):
sb.switch_to_frame("#example-container0 iframe")
sb.assert_element("circle.success-circle")
sb.switch_to_parent_frame()

sb.set_messenger_theme(location="top_center")
sb.post_message("SeleniumBase wasn't detected!", duration=3)
sb.uc_open_with_reconnect("nopecha.com/demo/turnstile", 3.2)
sb.uc_gui_click_captcha("#example-container0")
sb.uc_gui_click_captcha("#example-container5")
sb.sleep(3)
9 changes: 1 addition & 8 deletions examples/raw_order_tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,4 @@
url = "https://www.thaiticketmajor.com/concert/"
sb.uc_open_with_reconnect(url, 6.111)
sb.uc_click("button.btn-signin", 4.1)
sb.switch_to_frame('iframe[title*="Cloudflare"]')
if not sb.is_element_visible("svg#success-icon"):
sb.uc_gui_handle_cf()
sb.switch_to_frame('iframe[title*="Cloudflare"]')
sb.assert_element("svg#success-icon")
sb.switch_to_default_content()
sb.set_messenger_theme(location="top_center")
sb.post_message("SeleniumBase wasn't detected!")
sb.uc_gui_click_captcha()
7 changes: 4 additions & 3 deletions examples/raw_pyautogui.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
agent = None # Use the default UserAgent

with SB(uc=True, test=True, rtf=True, agent=agent) as sb:
url = "https://www.virtualmanager.com/en/login"
url = "https://gitlab.com/users/sign_in"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_handle_cf() # Ready if needed!
sb.assert_element('input[name*="email"]')
sb.assert_element('input[name*="login"]')
sb.assert_element('label[for="user_login"]')
sb.assert_element('input[data-testid*="username"]')
sb.assert_element('input[data-testid*="password"]')
sb.set_messenger_theme(location="bottom_center")
sb.post_message("SeleniumBase wasn't detected!")
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trio-websocket==0.11.1
wsproto==1.2.0
websocket-client==1.8.0;python_version>="3.8"
selenium==4.11.2;python_version<"3.8"
selenium==4.22.0;python_version>="3.8"
selenium==4.23.1;python_version>="3.8"
cssselect==1.2.0
sortedcontainers==2.4.0
fasteners==0.19
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.28.7"
__version__ = "4.29.0"
9 changes: 8 additions & 1 deletion seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,14 @@ def _uc_gui_click_captcha(
pass
else:
visible_iframe = False
if driver.is_element_present(".cf-turnstile-wrapper"):
if (
frame != "iframe"
and driver.is_element_present(
"%s .cf-turnstile-wrapper" % frame
)
):
frame = "%s .cf-turnstile-wrapper" % frame
elif driver.is_element_present(".cf-turnstile-wrapper"):
frame = ".cf-turnstile-wrapper"
elif driver.is_element_present(
'[data-callback="onCaptchaSuccess"]'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
'wsproto==1.2.0',
'websocket-client==1.8.0;python_version>="3.8"',
'selenium==4.11.2;python_version<"3.8"',
'selenium==4.22.0;python_version>="3.8"',
'selenium==4.23.1;python_version>="3.8"',
'cssselect==1.2.0',
"sortedcontainers==2.4.0",
'fasteners==0.19',
Expand Down

0 comments on commit b8996a6

Please sign in to comment.