From ee916874035de376eb41513df6ec281070c34ec4 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Wed, 24 Jul 2024 15:51:36 -0400 Subject: [PATCH 1/4] Refresh Python dependencies --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index f45ddc2d92f..11f1f6b8a16 100755 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.py b/setup.py index a7e6fef81ea..fb50691b779 100755 --- a/setup.py +++ b/setup.py @@ -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', From 383579765d132976bbfd144aafe1b8f9af63f5e7 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Wed, 24 Jul 2024 15:52:44 -0400 Subject: [PATCH 2/4] Update UC Mode --- seleniumbase/core/browser_launcher.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/seleniumbase/core/browser_launcher.py b/seleniumbase/core/browser_launcher.py index 5684068475a..7896a5a2059 100644 --- a/seleniumbase/core/browser_launcher.py +++ b/seleniumbase/core/browser_launcher.py @@ -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"]' From 149afd6cc223f50ff071d4903f7dc4be5952ea02 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Wed, 24 Jul 2024 15:55:04 -0400 Subject: [PATCH 3/4] Update examples --- examples/raw_bing_captcha.py | 14 ++------------ examples/raw_gui_click.py | 7 ++++--- examples/raw_nopecha.py | 17 ++++------------- examples/raw_order_tickets.py | 9 +-------- examples/raw_pyautogui.py | 7 ++++--- 5 files changed, 15 insertions(+), 39 deletions(-) diff --git a/examples/raw_bing_captcha.py b/examples/raw_bing_captcha.py index fe01fcb0eb8..232c75e38c1 100644 --- a/examples/raw_bing_captcha.py +++ b/examples/raw_bing_captcha.py @@ -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() diff --git a/examples/raw_gui_click.py b/examples/raw_gui_click.py index 768da6d0bbc..9c16633e676 100644 --- a/examples/raw_gui_click.py +++ b/examples/raw_gui_click.py @@ -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!") diff --git a/examples/raw_nopecha.py b/examples/raw_nopecha.py index 17eab52cbc0..66ac9e53f4f 100644 --- a/examples/raw_nopecha.py +++ b/examples/raw_nopecha.py @@ -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) diff --git a/examples/raw_order_tickets.py b/examples/raw_order_tickets.py index 43775eebd63..58017837a15 100644 --- a/examples/raw_order_tickets.py +++ b/examples/raw_order_tickets.py @@ -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() diff --git a/examples/raw_pyautogui.py b/examples/raw_pyautogui.py index 2c06bbe6777..4318c2446a4 100644 --- a/examples/raw_pyautogui.py +++ b/examples/raw_pyautogui.py @@ -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!") From 3d0d6040e2e680bebe5a9fd23ea3a3b7bb7b0585 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Wed, 24 Jul 2024 15:55:27 -0400 Subject: [PATCH 4/4] Version 4.29.0 --- seleniumbase/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seleniumbase/__version__.py b/seleniumbase/__version__.py index 5049436fc73..ea852d56e76 100755 --- a/seleniumbase/__version__.py +++ b/seleniumbase/__version__.py @@ -1,2 +1,2 @@ # seleniumbase package -__version__ = "4.28.7" +__version__ = "4.29.0"