Skip to content
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

can't use sendkeys or element.click() when browser background,only works when using javascripts #2068

Open
netgr opened this issue Nov 8, 2024 · 0 comments

Comments

@netgr
Copy link

netgr commented Nov 8, 2024

the code run normally on original chromedriver when i used on version 115, since i changed to UC(to bypass CF),all sendkeys or click() not works WHEN browser running in background. but when i switch the browser to the front ,sendkeys and click() all works again.
why,and any suggestion?
BTW,in my case ,i use multithread to open multi brower instances ,each one has its own account login of same website.

if name == "main":
drivers = []

for account in list_accounts:

    ucoptions = uc.ChromeOptions()
    ucoptions.add_argument(f'--proxy-server=http://{proxy.http_proxy}')
    print(proxy.http_proxy,account)
    ucoptions.page_load_strategy = 'eager'

    jsusername = account["username"]

    driver = uc.Chrome(version_main=130, use_subprocess=True,
                  browser_executable_path=fr"C:\Users\admin\Desktop\scan\chrome_win32{jsusername}\chrome{jsusername}.exe",
                       options=ucoptions)

    drivers.append(driver)
    time.sleep(5)

threads = [Thread(target=open_login, args=(driver, account)) for driver, account in zip(drivers, list_accounts)]

for thread in threads:
    thread.daemon = True
    time.sleep(120)
    thread.start()

for thread in threads:
    thread.join()


for driver in drivers:
    print(driver)
    # driver.quit() 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant