seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.45k stars 908 forks source link

SeleniumBase browser extremely slow #2845

Closed Ckin111 closed 3 weeks ago

Ckin111 commented 3 weeks ago

https://github.com/seleniumbase/SeleniumBase/assets/89425660/31c8abec-874e-49ca-9f16-c73896cd9d24

The captcha checkbox never actually stops loading. I'm on M1 mac and I saw the issue fix you had for it, and followed all the steps. Found all the paths to the drivers and deleted them, then ran sbase install chromedriver. I checked the network tab and the requests are all going through, but the browser UI is just overall very laggy and extremely slow. The recaptcha link works perfectly fine when I run it in regular chrome.

What should I do?

mdmintz commented 3 weeks ago

You definitely weren't using regular UC Mode in your example because regular UC Mode doesn't set --ignore-certificate-errors, which clearly appeared in your browser. (At best, that wouldn't appear unless you were setting a proxy server to use, or other non-default args, and you mentioned nothing about that, nor did you show any code.)

The following script runs in a few seconds for me: (Although if chromedriver / uc_driver hasn't been downloaded yet, add a few more seconds to that.)

from seleniumbase import SB

with SB(uc=True, test=True, incognito=True) as sb:
    url = "seleniumbase.io/apps/turnstile"
    sb.driver.uc_open_with_reconnect(url, 2)
    sb.driver.switch_to_frame("iframe")
    sb.driver.uc_click("span")
    sb.sleep(3)

Remember to use CSS Selectors (not XPath) for uc_click(selector), because the call gets made in JS, which doesn't accept XPath. (If you use XPath, you might get a regular click, which would easily be detected as Selenium.)

Also, UC Mode isn't as effective against reCAPTCHA. Solve the audio CAPTCHA from that instead: https://github.com/seleniumbase/SeleniumBase/issues/2821#issuecomment-2145126648

Ckin111 commented 3 weeks ago

The video was using a proxy, but without a proxy i have the same result. I also get the same unresponsive behavior from not uc modeIt was written with the driver via direct import syntax, and the code basically looks like this:

driver = Driver(uc=True)
    try:
        driver.get(url=“https://seleniumbase.io/apps/recaptcha”)
        input("Press Enter to close the browser...")
        # allows me the opportunity to play around with the browser 
        driver.quit()
    finally:
        driver.quit()

Even without any selectors, just opening the browser and trying to verify the captcha does not work.

Not only just clicking the captcha, but anything i do in this browser is slow and not responsive.

I purged my machine of all traces of selenium, uc_driver, chromedriver, and seleniumbase and only installed seleniumbase to no avail.

I'm working with this library on a team and I seem to be the only one facing this issue.

How could i further debug this issue?

mdmintz commented 3 weeks ago

Is it the same behavior between seleniumbase 4.27.5 and seleniumbase 4.27.4? Is it as slow when directly run from a command-prompt and not VS-Code? Also, are you using a VPN at all?