无法通过Selenium WebDriver python绑定启动Internet Explorer [英] Unable to launch Internet Explorer through Selenium WebDriver python bindings

查看:84
本文介绍了无法通过Selenium WebDriver python绑定启动Internet Explorer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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' 

以下是我启动IE的测试设置:

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

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

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

有什么想法吗?

推荐答案

您如何设置路径?

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

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

编辑:根据您的情况,在C:\IEDriver之前有一个分号,应将其删除.

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

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

Then restart your Eclipse and try again.

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

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")

这篇关于无法通过Selenium WebDriver python绑定启动Internet Explorer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆