Reputation: 361
Can anyone point me in the right direction?
I'm running Chrome using the following Python code:
opts = Options()
opts.add_argument("--disable-extensions")
self.browser = webdriver.Chrome(chrome_options=opts)
I am receiving the following error:
I've tried disabling extensions through code... as well as actually removing all extensions from Chrome before running the code. Neither solution has worked.
I'm running code using the following:
Upvotes: 1
Views: 9617
Reputation: 11
I had the same issue as above. Referencing the below link, the use of ".add_experimental_option('useAutomationExtension', False)" worked for me.
What is python's equivalent of useAutomationExtension for selenium?
Sample Code:
options = webdriver.ChromeOptions()
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options, executable_path=driverPath)
Upvotes: 1
Reputation: 29635
I run into the same kind of problem and I solved it following the answer to this other question:
What is python's equivalent of useAutomationExtension for selenium?
For me, the necessary part of this answer is to set the chromeOptions capability 'useAutomationExtension' to false. My code looks like:
from selenium import webdriver
capabilities = { 'chromeOptions': { 'useAutomationExtension': False}}
driver = webdriver.Chrome(desired_capabilities = capabilities)
driver.get('https://www.python.org/')
I'm not sure if the "--disable-extensions" you add as argument is still necessary, but I think you can keep it by changing capabilities in the code above such as:
capabilities = { 'chromeOptions': { 'useAutomationExtension': False,
'args': ['--disable-extensions'] }
}
Both works for me and I don't get the error anymore. My settings are a bit different (Chrome v63, ChromeDriver 2.35, Selenium 3.9 and Python 2.7) but I hope it will help you.
Upvotes: 6
Reputation: 193388
Here's the solution to your Question:
Add the following ChromeOptions to overcome the error:
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("--js-flags=--expose-gc");
options.addArguments("--enable-precise-memory-info");
options.addArguments("--disable-popup-blocking");
options.addArguments("--disable-default-apps");
options.addArguments("test-type=browser");
options.addArguments("disable-infobars");
WebDriver driver = new ChromeDriver(options);`
Apologies as the code is in Java, you have to convert it into Python format.
Let me know if this helps you.
Upvotes: 0