ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
10.08k stars 1.17k forks source link

Undetectable ChromeDriver Threading Not Locate Element #547

Open Jey0707 opened 2 years ago

Jey0707 commented 2 years ago

I have a problem when spawning many pages of selenium to do simultaneous actions at the same time.

Selenium cannot find the items because there are other pages above it.

Example: I open two pages of selenium, one on top of the other (it happens even if I overlap the selenium page with any other window), one on top of the other. The page below cannot find/click buttons/input

from seleniumwire.undetected_chromedriver.v2 import Chrome
from soupsieve import escape
import undetected_chromedriver as uc

with open('proxy.txt') as f:
        lines = f.readlines()
        if len(lines) > 0:
            x = random.choice(lines)
            PROXY_HOST = x.split(':')[0]
            PROXY_PORT = x.split(':')[1]
            PROXY_USER = x.split(':')[2]
            PROXY_PASS = x.split(':')[3].replace("\n", "")
                 options = {
                "disable_capture": True,
                'request_storage_base_dir': './tmp',
                "proxy": {
                    'http': 'http://'+PROXY_USER+':'+PROXY_PASS+'@'+PROXY_HOST+':'+PROXY_PORT,
                    'https': 'https://'+PROXY_USER+':'+PROXY_PASS+'@'+PROXY_HOST+':'+PROXY_PORT
                }
            }

            proxies = {
                        'http': 'http://'+(x.split(':')[2]+':'+x.split(':')[3]+'@'+x.split(':')[0]+':'+x.split(':')[1]).replace("\n", ""),
                        'https': 'http://'+(x.split(':')[2]+':'+x.split(':')[3]+'@'+x.split(':')[0]+':'+x.split(':')[1]).replace("\n", "")
                    }
        else:
            options = {
                'disable_capture': True,
                'request_storage_base_dir': './tmp'
            }

            proxies = {}

    #########-SELENIUM START-#########///////////////////////////////////////////// 

    chrome_options = uc.ChromeOptions()
    chrome_options.add_argument('--disable-popup-blocking') 
    chrome_options.add_argument('--window-size=300,700')
    chrome_options.add_argument('--blink-settings=imagesEnabled=false')
    chrome_options.add_argument('--no-first-run')
    chrome_options.add_argument('--no-service-autorun')
    chrome_options.add_argument('--password-store=0')
    chrome_options.add_argument('--log-level=3')

     driver = Chrome(options=chrome_options,seleniumwire_options=options,use_subprocess=True)

     driver.get(url)

     driver.find_elements_by_xpath('//*[@id="Email"]')[1].send_keys(email)
ultrafunkamsterdam commented 2 years ago

not a specific undetected_chromedriver issue. besides you did not read the readme, and your code looks like shit. Even if i wanted to troubleshoot user code, there is no info whatsoever, no errors, no urls, no version, os, platform used etc. etc.

closing

Virusback commented 2 years ago

Bro did y find solution

NICK-CHAOS-DEMON commented 1 year ago

not a specific undetected_chromedriver issue. besides you did not read the readme, and your code looks like shit. Even if i wanted to troubleshoot user code, there is no info whatsoever, no errors, no urls, no version, os, platform used etc. etc.

closing

You UC codes look like shit.