-
Notifications
You must be signed in to change notification settings - Fork 979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UC Mode users should upgrade to 4.30.8 (or newer if available) #3130
Comments
Stopped working around 3 hours ago, upgraded, still not working :( |
Version 4.30.1 would cause the cursor to click at the top left corner of the web browser. I would double check that you upgraded or other components because it is working fine for me. |
seleniumbase==4.30.7 I will check because maybe is trying to solve the dep from another folder... Any tips? I'm still trying to adapt to python |
It's hard to say without actually seeing the code. My best suggestion is to test 4.30.7 in a separate environment to ensure its working properly and then slowly break down the code until you notice a change in behaviour. |
As per I can see in headed mode, it's solving the cloudflare challenge but it's recognized as bot (the screen stay as white, which means bot detected). Reconnect time test with 7, 10 and 15, re-installed deps, even installed from github, still not working. I will do more tests in some minutes, but I'm run out of ideas. |
Seems like sb.uc_gui_click_captcha() working correctly but sb.uc_gui_handle_cf() keeps crashing, can you check please @mdmintz |
As additional information, that's my code to solve cloudflare: sb.uc_click('[type="submit"]', reconnect_time=7)
try:
# with lockCloudflare:
sb.post_message("Solving cloudflare...")
sb.uc_gui_click_captcha() # Only if needed
except Exception as e:
logger.error("ERROR: Cloudflare challenge error")
votesSummary["totalCloudflareError"] += 1
raise e |
Looks like it. In the meantime, people should use |
yep but I can't use it on my linux ubuntu remote server with |
As per the test i've did (with headed mode), the cloudflare is detecting the selenium attached, because it changes to white the screen before the cursor starts moving. |
Updated title: "UC Mode users should upgrade to |
Upgraded and same error from here. Tested with both Any clues @mdmintz? |
These scripts are all working for me: from seleniumbase import SB
with SB(uc=True, test=True) as sb:
url = "https://gitlab.com/users/sign_in"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_captcha() # Only if needed
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!") And: from seleniumbase import SB
with SB(uc=True, test=True) as sb:
url = "https://gitlab.com/users/sign_in"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_handle_captcha() # Only if needed
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!") And: from seleniumbase import SB
with SB(uc=True, test=True, locale_code="en") as sb:
url = "https://www.cloudflare.com/login"
sb.uc_open_with_reconnect(url, 5.5)
sb.uc_gui_handle_captcha() # PyAutoGUI press Tab and Spacebar
sb.sleep(2.5)
with SB(uc=True, test=True, locale_code="en") as sb:
url = "https://www.cloudflare.com/login"
sb.uc_open_with_reconnect(url, 5.5)
sb.uc_gui_click_captcha() # PyAutoGUI click. (Linux needs it)
sb.sleep(2.5) If they aren't working for you right now, then your IP Address or proxy may already be blocked. And note that on Linux, you may need to use the And if using Windows, you may need to set the scaling factor to 100%. (On higher scaling factors, there may be problems calculating coordinates, so just set scaling to 100% to get around that.) |
I'm on linux, tried with and without proxy. In any case, If I do manually the click, everything works fine, this only fails when selenium attachs to the browser, so the issue is not related to the IP. Video attached (I insist, if I do the click manually, it works fine): EDIT: In the video is not clear, but this happens when cloudflare tab is re-open (when it's attached to selenium) |
Things are working for me right now in GitHub Actions: https://github.com/mdmintz/undetected-testing/actions/runs/10838173166/job/30075795632 * Here's the script that was run:from seleniumbase import SB
with SB(uc=True, test=True, rtf=True) as sb:
url = "https://seleniumbase.io/hobbit/login"
sb.uc_open_with_disconnect(url, 3)
sb.uc_gui_press_keys("\t ")
sb.reconnect(3)
print(sb.get_current_url())
sb.assert_text("Welcome to Middle Earth!", "h1")
sb.set_messenger_theme(location="bottom_center")
sb.post_message("SeleniumBase wasn't detected!")
with SB(uc=True, test=True) as sb:
url = "https://www.virtualmanager.com/en/login"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_captcha()
print(sb.get_page_title())
sb.assert_element('input[name*="email"]')
sb.assert_element('input[name*="login"]')
sb.set_messenger_theme(location="bottom_center")
sb.post_message("SeleniumBase wasn't detected!") The second test in the file clicks a CAPTCHA. (The CAPTCHA page only appears on Linux.) Right before I shipped the fixes, it was failing like this: But on
|
After a lot of re-tries (even I tried in Ubuntu instead of Debian, not on Windows because it was failing python), I notice that is related to the website. I notice time ago, that if you wait too long, the website turns white, but the seleniumbase was working fine until today. Now, with the following code, it just lose the content: from seleniumbase import SB
with SB(uc=True, test=True, locale_code="en") as sb:
url = "https://www.xtremetop100.com/in.php?site=1132357179"
sb.uc_open_with_reconnect(url, 5.5)
sb.type('input[name="captcha_code"]', "dummy")
sb.uc_click('[type="submit"]', 5.5)
sb.uc_gui_click_captcha() # PyAutoGUI click. (Linux needs it)
sb.sleep(9) There is any trick to avoid the "refresh"? (I notice that it's not happening in the other examples, so maybe is a CloudFlare protection?) |
@ProtocolNebula It's because you can't go directly to And because there's another CAPTCHA on the previous page (not a CF one) it won't let you through if that wasn't solved correctly. Otherwise, it would be simple to get through with something like: from seleniumbase import SB
from seleniumbase import config as sb_config
with SB(uc=True, test=True, locale_code="en") as sb:
url = "https://www.xtremetop100.com/in.php?site=1132357179"
sb.uc_open_with_reconnect(url, 3)
sb.type('input[name="captcha_code"]', "dummy")
sb.uc_click('[type="submit"]', reconnect_time="disconnect")
sb.sleep(3)
sb.uc_gui_press_keys("\t ")
sb.reconnect(6) UC Mode works for the straightforward open a url that is already a CF Turnstile page. It won't solve your word puzzle. Simple example of normal UC Mode usage: from seleniumbase import SB
with SB(uc=True, test=True) as sb:
url = "https://gitlab.com/users/sign_in"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_captcha() # Only if needed
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!") |
@mdmintz , first of all, thanks for the support. I've been using my bot for 3 weeks, it worked like a charm until today. The sb.uc_gui_press_keys("\t ") I run out of ideas, as a patch, I'm trying to implement an external service to solve these captchas, but the idea is still to use this tool (the tools are too expensive). PS: I solve the captcha after ensuring cloudflare is skipped, so the dummy text I've put in the example is the same I'm using. |
@ProtocolNebula Note that you can print and or reuse coordinates that you receive for later. Eg: from seleniumbase import SB
from seleniumbase import config as sb_config
with SB(uc=True, test=True, locale_code="en") as sb:
url = "https://www.xtremetop100.com/in.php?site=1132357179"
sb.uc_open_with_reconnect(url, 1)
sb.type('input[name="captcha_code"]', "dummy")
sb.uc_click('[type="submit"]', reconnect_time=3)
sb.uc_gui_click_captcha() # Expected to fail now
x, y = sb_config._saved_cf_x_y
print(x, y)
sb.uc_open_with_reconnect(url, 1)
sb.type('input[name="captcha_code"]', "dummy")
sb.uc_click('[type="submit"]', reconnect_time="disconnect")
sb.sleep(3)
sb.uc_gui_click_x_y(x, y)
sb.reconnect(6) They are stored in |
Oh, that method is so cool. I guess they enabled under attack mode or something, because neither with this code it works. I tried to move to a random position first and wait for 1 second, but is still blank!! I cannot understand, is so frustrating. What I don't know how the other people is solving this part, the only way It could be is using external payment methods. I'll try again tomorrow, I hope it solves with magic. Again, thanks for the whole support. Of course, I'll be glad if someone finds a way to skip this. |
@ebsawyer This script works in all the environments: from seleniumbase import SB
from seleniumbase import config as sb_config
with SB(uc=True, test=True, locale_code="en") as sb:
url = "https://www.indeed.com/jobs?q=%27team+member%27&l=New+York%2C+NY&sort=date&fromage=1&filter=0"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_captcha()
if hasattr(sb_config, "_saved_cf_x_y"):
x, y = sb_config._saved_cf_x_y
sb.uc_open_with_disconnect(url)
sb.sleep(4)
sb.uc_gui_click_x_y(x, y)
sb.sleep(4) |
@ebsawyer You have to reconnect before you can perform actions again. Eg. from seleniumbase import SB
from seleniumbase import config as sb_config
with SB(uc=True, test=True, locale_code="en") as sb:
url = "https://www.indeed.com/jobs?q=%27team+member%27&l=New+York%2C+NY&sort=date&fromage=1&filter=0"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_captcha()
if hasattr(sb_config, "_saved_cf_x_y"):
x, y = sb_config._saved_cf_x_y
sb.uc_open_with_disconnect(url)
sb.sleep(4)
sb.uc_gui_click_x_y(x, y)
sb.reconnect(4)
breakpoint() |
No matter the URL, use something like this for bypassing CF CAPTCHAs: from seleniumbase import SB
from seleniumbase import config as sb_config
with SB(uc=True, test=True, locale_code="en") as sb:
url = "URL"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_captcha()
if hasattr(sb_config, "_saved_cf_x_y"):
x, y = sb_config._saved_cf_x_y
sb.uc_open_with_disconnect(url)
sb.sleep(4)
sb.uc_gui_click_x_y(x, y)
sb.reconnect(4)
breakpoint() |
I have tried the snippet above with the latest changes, however I have experienced a few issues: The following change: https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/browser_launcher.py#L986 Triggers a new refresh of the page, and a sleep of 3.8 seconds, followed by a click on the input box, the issues I see are:
Then the following: https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/browser_launcher.py#L1004 What does the The issue i have noticed here is the following:
https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/browser_launcher.py#L1004 Here we bump in the same issues of the 3.8 seconds that would suffice to render the page with the input box fully and then rely on pyautogui to click the input box when ready. I had this process stalling. I am not sure if there can be a wait in between that pauses the execution until the input box is present and can be clicked or can the timeout value for Previously the flow was more simple as there were no the extra refreshes of the page due the new conditions, I would |
There will be an extra page refresh because Selenium gets detected when calculating the CAPTCHA coordinates. Adjust your script as needed in #3130 (comment). |
This comment was marked as outdated.
This comment was marked as outdated.
Closing this in favor of #3236. |
UC Mode users should upgrade to
4.30.8
(or newer if available)In case you missed #3128 and #3131, CF made changes to their CAPTCHAs, and new UC Mode updates were needed to continue clicking them successfully (when they force you to click the CAPTCHA to bypass it).
This includes fixes for the following methods:
sb.uc_gui_click_captcha()
sb.uc_gui_handle_captcha()
These CAPTCHA changes shouldn't be surprising to anyone who's already watched:
https://www.youtube.com/watch?v=-EpZlhGWo9k (my latest UC Mode video tutorial: "Revenge of the CAPTCHAs").
Upgrade to SeleniumBase
4.30.8
(or newer if available) to continue bypassing CAPTCHAs as usual.Selenium is used to calculate the location of the CAPTCHA (or the number of times to press Tab before pressing Spacebar) and then the page needs to reload before performing those actions again because Selenium gets detected when calculating locations / tab presses. After the page refreshes,
PyAutoGUI
saves the day by performing actions in a stealthy way.The text was updated successfully, but these errors were encountered: