H
H
Held69912021-07-29 21:56:19
Python
Held6991, 2021-07-29 21:56:19

How to avoid being blocked by Selenium WebDriver site?

Hello, I have this code -

from time import sleep
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from fake_useragent import UserAgent

ua = UserAgent()
us_ag = ua.random
chrome_options=webdriver.ChromeOptions()
prefs = {"plugins.always_open_pdf_externally": True}
chrome_options.add_experimental_option("prefs",prefs)
chrome_options.add_experimental_option('excludeSwitches', ['enable-automation'])
chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--profile-directory=Default')
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--disable-plugins-discovery");
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument(f"user-agent={us_ag}")
driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)
driver.get("https://coinsniper.net/login")
sleep(5)
#driver.close()

I just go in and immediately get a block (and I change the IP every time) -
6102f9fd49477956391115.png

Tell me, please, how to solve this?

And one more mini-problem, with driver.close() in the task manager, chromedriver.exe still remains, is this how it should be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Held6991, 2021-07-30
@Held6991

I solved it with these settings:

options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features=AutomationControlled")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question