0

I wrote some python script combine with selenium to login a website automatically,it works well on my PC. Now I compress the script as exe file to run on a remote PC,but it cannot load the page, stucks at "checking your browser before accessing xxx". Why? enter image description here

here is my code:

op = webdriver.ChromeOptions()
op.add_experimental_option('excludeSwitches',['enable-logging'])
ser = Service('chromedriver.exe')
wd = webdriver.Chrome(service=ser,options=op)
wd.get(self.url)
# time.sleep(30)
try:

    email_input = WebDriverWait(wd,30).until(
        EC.presence_of_element_located((By.ID,"user_email"))
    )
except Exception as e:
    print(e)

1 Answers1

0

It's quite evident from the snapshot that cloudflare have detected your program as a and further navigation is blocked.

To prevent detection you can add the following argument through add_argument():

--disable-blink-features=AutomationControlled

Sample Code Block:

op = webdriver.ChromeOptions()
op.add_experimental_option("excludeSwitches", ["enable-automation"])
op.add_experimental_option('excludeSwitches', ['enable-logging'])
op.add_experimental_option('useAutomationExtension', False)
op.add_argument('--disable-blink-features=AutomationControlled')
ser = Service('C:\\BrowserDrivers\\chromedriver.exe')
wd = webdriver.Chrome(service=ser,options=op)
wd.get(self.url)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352