简体   繁体   中英

Unable to launch Internet Explorer through Selenium WebDriver python bindings

I've downloaded IEDriver and tested both 32 and 64bit versions (I am running 64bit Windows 7) and I included the folder containing the EXE to path in environment variables.

I've restarted Eclipse and my whole system but still get the exception

selenium.common.exceptions.WebDriverException: Message:
'IEDriver executable needs to be available in the path.
Please download from http://code.google.com/p/selenium/downloads/list
and read up at http://code.google.com/p/selenium/wiki/InternetExplorerDriver' 

Below is my test setup to launch IE:

def setUp(self):
    self.driver = webdriver.Ie()
    self.driver.implicitly_wait(30)
    self.base_url = "https://accounts.google.com/"
    self.verificationErrors = []
    self.accept_next_alert = True

I'm stumped. I've had it working previously but removed it and now want to put it back on my system. I'm using Python 3.3, Eclipse 4.2.2, Selenium 2.31 and IE 10.0.92

Any ideas?

How did you set your path?

For example, if your IEDriverServer.exe is in C:\\ , then you should add C:\\ to your PATH, instead of C:\\IEDriverServer.exe

EDIT : In your case, there is a semi colon before C:\\IEDriver , which should be removed.

Then restart your Eclipse and try again.

EDIT : Could you please also try specify path to IEDriverServer.exe in the code?

from selenium import webdriver

driver = webdriver.Ie(r"C:\\IEDriver\\IEDriverServer.exe")

It seems that newer Selenium 2 versions use different approach to communicate with IE than earlier. Just follow the instructions in the below link and you should be fine.

Driver executable must be set by the webdriver.ie.driver system property

Also Check the below point. I have encountered the same when I am Automating IE web application

On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM