小编典典

无法通过Selenium WebDriver python绑定启动Internet Explorer

selenium

我已经下载了IEDriver并测试了32位和64位版本(我正在运行64位Windows 7),并且在环境变量中包括了包含EXE路径的文件夹。

我已经重新启动了Eclipse和整个系统,但是仍然出现异常

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'

以下是我启动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

我很沮丧 我以前曾经使用过它,但是现在将其删除了,现在想将其放回系统中。我正在使用Python 3.3,Eclipse 4.2.2,Selenium
2.31和IE 10.0.92

有任何想法吗?


阅读 275

收藏
2020-06-26

共1个答案

小编典典

您是如何设定道路的?

例如,如果您IEDriverServer.exe在中C:\,则应添加C:\到PATH中,而不是C:\IEDriverServer.exe

编辑 :在您的情况下,在前有一个分号C:\IEDriver,应将其删除。

然后重新启动Eclipse,然后重试。

编辑 :您还可以尝试在代码中指定IEDriverServer.exe的路径吗?

from selenium import webdriver

driver = webdriver.Ie(r"C:\\IEDriver\\IEDriverServer.exe")
2020-06-26