I can't seem to open up Google Chrome or Internet Explorer through Selenium 2's Python library. I am using Windows 7, 64 bit.
I have completed the following steps:
- Installed python - 2.7.5
- Installed selenium 2.33
- Included C:\Python27 & C:\Python27\Scripts in the Environment Variable - Path
- Downloaded the 32 bit (I am running 64 bit but I could not find the 32 bit version) windows Chrome Driver that supports v27-30 (I am on 28) and placed it into C:\Python27\Scripts
- Downloaded the 64 bit IE driver that supports up to IE9 (I downgraded IE10 to IE9). I placed the driver into C:\Python27\Scripts
Whenever I type:
from selenium import webdriver
driver = webdriver.Ie()
OR
from selenium import webdriver
driver = webdriver.Chrome()
into the Python shell, no browser pops up, the shell just freezes for a couple of minutes and then outputs an error message.
IE Error message:
selenium.common.exceptions.WebDriverException: Message: 'Can not connect to the IEDriver'
Chrome Error message:
urllib2.HTTPError: HTTP Error 503: Service Unavailable
It works perfectly fine with firefox. The funny thing is, is that the process (IEDriver and ChromeDriver) starts per the TaskManager, but the window never shows up.
I haven't been able to solve this problem with the path I've downloaded it to, but have been able to workaround it by defining the path to the driver, like so:
or
In python-selenium
webdriver.Ie
is just a shortcut for executing IEDriver.exe and connecting to it throughwebdriver.Remote
. For example, you could start IEDriver.exe from command line:and replace
webdriver.Ie()
with the following code:You will get the same result.
Specifically in your case is most likely that you have some system proxy settings that force it connect to 127.0.0.1 through proxy server. Probably when you disable it as described in answer Python: Disable http_proxy in urllib2, you can solve the problem: