What an awful little error message this is:
WebDriverException: Message: u'unknown error: chrome failed to start\n (Driver info: chromedriver=2.0,platform=Windows NT 5.1 SP3 x86)'
I’ve spent more time than I’d like to admit to trying to figure out the “why” of this message.
This didn’t help much:
Also, there’s a lot of useful info about making sure Selenium can locate ChromeDriver.exe. All very good, but not what I was looking for.
This sent me in the right direction, but it’s section on overriding the binary_location shows outdated example code (or, at the very least it didn’t work for me in SWD v2.33)
The root cause
My installation of windows XP uses Spanish as it’s default language (I’m currently working in Barcelona).
The default install location for google chrome on Windows XP English is:
C:\Documents and Settings\<USERNAME>\Local Settings\ Application Data\Google\Chrome\Application\chrome.exe
on a Spanish installation this translates to:
C:\Documents and Settings\<USERNAME>\Configuración local\ Datos de programa\Google\Chrome\Application
ChromeDriver looks for Chrome in the default location and if it doesn’t find it, it returns the (wonderfully descriptive) error message quoted at the beginning of the post.
The following code allows me to launch ChromeDriver successfully (using the python bindings):
import unittest from selenium import webdriver class Test_Login(unittest.TestCase): def setUp(self): chromeOptions = webdriver.ChromeOptions() chromeOptions.binary_location = "C:\\Documents and Setting\\myusername\\Configuración local\\Datos de programa\\Google\\Chrome\\Application\\chrome.exe" self.driver = webdriver.Chrome(chrome_options=chromeOptions)
So, now that the (bloody) tools are correctly configured I can actually start writing the tests. Hooray!