1

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:

enter image description here

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:

  • ChromeDriver 2.28
  • Chrome V57.0.2987.110
  • Selenium 3.3.1
  • Python 2.7
Searle
  • 341
  • 4
  • 16
  • Alternatively, does any one know how to easily close the annoying error via the Python code? – Searle Mar 29 '17 at 18:43

3 Answers3

6

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.

Ben.T
  • 29,160
  • 6
  • 32
  • 54
1

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)
tsarge6
  • 11
  • 2
0

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.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Modified your code slightly for Python, and gave it a try. Still the same issue, unfortunately. Any other suggestions? Thanks. – Searle Mar 28 '17 at 20:36
  • @Searle can you ensure that you are not using equivalent Python code of `driver.manage().window().maximize()` later in the code? – undetected Selenium Mar 28 '17 at 20:51
  • Aside from the argument you mentioned above for maximizing the window, I haven't touched parameters regarding position or size. – Searle Mar 28 '17 at 21:03
  • @Searle Can you clear the browser cache once & kill all the chrome driver instances from Task manager? I would suggest to restart the PC once. This Chrome configuration was working well till today evening my time. – undetected Selenium Mar 28 '17 at 21:15
  • @Searle You may need to run the CCleaner once to remove the unwanted stuff from your Temp folder & your system. – undetected Selenium Mar 28 '17 at 22:42
  • Logged out and back in, and then executed the same code. Same error. I wasn't receiving this error yesterday, it was an overnight Chrome update to v57.xxx. – Searle Mar 28 '17 at 22:44
  • @Searle was just wondering shouldn't it be `opts=ChromeOptions()` – undetected Selenium Mar 28 '17 at 22:51
  • I'm using `from selenium.webdriver.chrome.options import Options` to import the Options class, and then I'm just instantiating it. Just another coding difference. – Searle Mar 29 '17 at 00:43