My goal is to get webpage HTML automatically (without any other actions).
I'm trying to disable Automation Extension for ChromeDriver 79 to avoid selenium detection.
As I know, it doesn't work after ChromeDriver 78. Is there a way to do it in version 79?
def get_chromedriver(path, use_proxy=False, user_agent=None):
chrome_options = webdriver.ChromeOptions()
if use_proxy:
pluginfile = 'proxy_auth_plugin.zip'
print("proxy")
with zipfile.ZipFile(pluginfile, 'w') as zp:
zp.writestr("manifest.json", manifest_json)
zp.writestr("background.js", background_js)
chrome_options.add_extension(pluginfile)
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('useAutomationExtension', False)
if user_agent:
chrome_options.add_argument('--user-agent=%s' % user_agent)
driver = webdriver.Chrome(
path,
chrome_options=chrome_options)
return driver