Closed mdmintz closed 4 days ago
Hey, so that's the error I was facing the other day in my last comment . I could have been more meaningful. Anyway thanks for fixing it.
This was resolved in 4.28.1
- https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.28.1
driver.uc_open(url) driver.uc_gui_handle_cf()
In Mac uc_gui_handle_cf not working, i'm getting a captcha for GitLab login even nothing has changed. seleniumbase==4.28.3
driver = Driver(uc=True,)
try:
driver.uc_open("https://gitlab.com/users/sign_in")
driver.uc_gui_handle_cf()
driver.sleep(50)
print("done")
except Exception as e:
print(e)
finally:
driver.quit()
Working for me:
from seleniumbase import Driver
with Driver(uc=True) as driver:
url = "https://gitlab.com/users/sign_in"
driver.uc_open_with_reconnect(url, 4)
driver.uc_gui_handle_cf() # Not always needed
driver.assert_text("Username", '[for="user_login"]', timeout=3)
driver.assert_element('label[for="user_login"]')
driver.highlight('button:contains("Sign in")')
driver.highlight('h1:contains("GitLab.com")')
@mdmintz I have used the same code on my Mac, but it still does not resolve the captcha in GitLab.
As per screenshots The Python app always jumps but does not start. I don't know why I need to give permission for the external library that is already installed while it was added uc_gui_handle_cf into the code?
I have not changed anything, including the fingerprint, VPN, or proxy, yet I still get this captcha. It should work as expected.
For uc_gui_handle_cf()
to work, pyautogui
needs permission to click things on your desktop. I saw this related item: https://github.com/asweigart/pyautogui/issues/834 (Maybe more in https://github.com/asweigart/pyautogui). If pyautogui
is asking for permission, then it probably doesn't have it yet, and it needs it.
On macOS / Windows, the CAPTCHA should be bypassed automatically without needing to click it (unless they already flagged your IP Address, in which case nothing can be done). For slow internet connections, you may need to increase the number in uc_open_with_reconnect(url, 4)
.
I have tried with proxy and VPN also even though it gives me a captcha as per the screenshot. let me resolve the permission things first, if you have any solution even getting this error please let me know what should I check.
Add support for
uc_gui_handle_cf()
withDriver()
andDriverContext()
formatsCurrently, if running this code:
That leads to this stack trace:
Here's the workaround for now using
SB()
: (Which includes the virtual display needed on Linux)Once this ticket is resolved, Linux users who use
Driver()
orDriverContext
formats in UC Mode will still need to setpyautogui._pyautogui_x11._display
toXlib.display.Display(os.environ['DISPLAY'])
on Linux in order to sync uppyautogui
with theX11
virtual display after callingsbvirtualdisplay.Display(visible=True, size=(1366, 768), backend="xvfb", use_xauth=True).start()
. (ForXlib
, useimport Xlib.display
afterpip install python-xlib
.)