1

I am having trouble using Selenium Chromedriver on Windows 7. To display the problem, I've boiled it down to a simple script to simply launch the New York Times website:

from selenium import webdriver

# --LOCATIONS --
# The Chrome app:
# C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
# The Chrome binary:
# C:\Python27\Scripts\chromedriver.exe

chromedriver_path = "C:\Python27\Scripts\chromedriver.exe"

driver = webdriver.Chrome(executable_path=chromedriver_path)

driver.get('https://www.nytimes.com/')

The Chrome Browser launches (leading me to speculate that there's nothing with the Chrome application path), but rather than going to the NYT website, the following happens:

enter image description here

The string data:, appears in the URL address bar, and 2 alert notifications come up: one that says "You are using an unsupported command-line flag: --ignore-certificate-errors. Stability and security will suffer." and another that says "Disable developer mode extensions: Extensions running in developer mode can harm your computer. If you're not a developer, you should disable these extensions running in developer mode to stay safe."

This didn't happen when I used Selenium for Firefox- so I'm not sure what to do with Chrome. I've tried looking this issue up on the internet beforehand, but all the issues/solutions are dated from a few years back (2014-2015), and I believe the Selenium packages and Chromedriver binaries have been updated since then.

Does anyone know how I can get my code working? Thank you in advance.

daOnlyBG
  • 595
  • 4
  • 20
  • 49
  • Try adding this line `os.environ["webdriver.chrome.driver"] = chromedriver_path` right before the first line where you specify what `driver` equals ,Edit: I don't think it's a problem with the nytimes website as I was just able to access it no problems with my `selenium-chromedriver` – gold_cy Jan 27 '17 at 18:03
  • @DmitryPolonskiy I tried it, but like attempting the many fixes I've seen online, the only result is a popup that says "chromedriver.exe has stopped working." In other words, a crash. Here's specifically what I coded in: `chromedriver_path = "C:\Python27\Scripts\chromedriver.exe" os.environ["webdriver.chrome.driver"] = chromedriver_path driver = webdriver.Chrome(executable_path=chromedriver_path, chrome_options=chrome_opts)` – daOnlyBG Jan 27 '17 at 18:12
  • Sorry, that's all I got. I'm relatively new to `selenium` so I can't offer any other advice. – gold_cy Jan 27 '17 at 18:18
  • @DmitryPolonskiy Hey, thanks anyway- I appreciate your time! – daOnlyBG Jan 27 '17 at 18:19
  • read this: http://stackoverflow.com/questions/23055651/disable-developer-mode-extensions-pop-up-in-chrome see if it helps you – MooingRawr Jan 27 '17 at 19:52
  • 1) If you click Cancel, does it go on to the NYT website? 2) Do you have other instances of chrome, chromedriver, or conhost running? Sometimes I have to Ctrl-Alt-Del to the Windows Task Manager and kill all the Processes with these names. Then when you re-run, it works fine. – Suzanne Jan 27 '17 at 20:03
  • @Suzanne I don't know what you mean by clicking "Cancel," since there's no cancel button, just an 'x' to close out of the alert boxes. When I do that, the browser doesn't go anywhere- it just stays blank with `data:,` in the URL bar. – daOnlyBG Jan 27 '17 at 20:05
  • "Cancel" = in the alert box called "Disable developer mode extensions" (screenshotted above.) Sorry I wasn't specific. – Suzanne Jan 27 '17 at 20:09
  • @Suzanne, ah, I see. No, the browser doesn't go anywhere even if I press "cancel." – daOnlyBG Jan 27 '17 at 20:11

2 Answers2

2

I'd have to see your computer to examine how Chromedriver is installed, but as that's not quite feasible, I would at least recommend uninstalling any chromedriver executables on your computer and then downloading it into your project's directory.

It's really just an IT rule-of-thumb; if you've ruled out every other issue that you're aware of, then there's a good chance the problem is something you're not recognizing. Start at square 1 and reinstall Chromedriver.

Yuro Doosh
  • 65
  • 4
1

You can disable Developer mode extension by following code(java)

ChromeOptions options = new ChromeOptions();
options.addArguments("chrome.switches","--disable-extensions");
System.setProperty("webdriver.chrome.driver","F:\\Stuff\\Jars\\chromedriver.exe");
driver = new ChromeDriver(options);
driver.manage().window().maximize();
driver.get("https://www.nytimes.com/");
Akash W
  • 371
  • 1
  • 10
  • You create the options object, but you're not using it anywhere. I assume it's meant to be a constructor parameter? – Clay H Aug 10 '17 at 19:42