Selenium python - being detected by website (advanced)

Viewed 65

Ive been using selenium for some time now but finally the website im interacting with has caught onto me and blocked me from logging in on any account, however when i log on using a normal browser everything works fine. Here are the measures im using at the moment to try prevent the website detecting me:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-blink-features=AutomationControlled")
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
chrome_options.add_experimental_option('useAutomationExtension', False)
chrome_options.add_experimental_option('useAutomationExtension', False)
chrome_options.add_argument('--profile-directory=Default')
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument('--allow-insecure-localhost')
chrome_options.add_argument('--allow-running-insecure-content')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument(f'user-agent={user_agent}') # user agent was specified befor
chrome_options.add_argument('--ignore-certificate-errors')
#chrome_options.add_extension('C:/Users/danlu/Downloads/extension_2_1_10_0.crx')


chrome_options.add_argument(r"user-data-dir=C:\Users\danlu\AppData\Local\Google\Chrome\User 
Data\Default")
chrome_options.add_argument("profile-directory=Guest Profile")


    


driver = uc.Chrome(executable_path=r"C:chromedrivermain.exe", options=chrome_options)
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": """Object.defineProperty(navigator, 'webdriver', {get: () => undefined})"""})
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": """Object.defineProperty(navigator, 'plugins', {get: () => [ 1, 2, 3]})"""})

Also need to add i have changed the %cdc string and use ActionChains to mimic human scrolls and clicks

Any other measures i can take to prevent detection?

0 Answers
Related