在Internet Explorer中使用Python进行硒测试 [英] Selenium test with Python in Internet Explorer
问题描述
我编写了一个脚本,该脚本使用python和Selenium打开网络浏览器.使用以下代码,它可以在Firefox上正常工作:
I have written a script that opens a web browser using python and Selenium. It works fine with Firefox using the following code:
from selenium import webdriver
driver = webdriver.Firefox()
当我用IE替换Firefox(开始输入时的建议值)时,我收到消息IEDriver executable needs to be available in the path.
When I replace Firefox with IE (the suggested value when I start typing), I get the message IEDriver executable needs to be available in the path.
from selenium import webdriver
driver = webdriver.IE()
推荐答案
-
根据您的操作系统(Windows 32或64位)下载IE驱动程序
Download IE Drivers based on your OS (Windows 32 or 64 bit)
a. 下载 Windows 32位驱动程序
a. Download Windows 32 bits driver
OR
b. 下载 Windows 64位驱动程序
b. Download Windows 64 bits driver
解压缩zip文件并将IEDriverServer.exe文件复制到某个位置,例如E:\ IEDriver
Extract the zip and copy IEDriverServer.exe file to some location e.g. E:\IEDriver
编写以下脚本
from selenium import webdriver
browser = webdriver.Ie("e:\\IEDriver\\IEDriverServer.exe")
运行脚本,它应该打开IE浏览器...
Run the script, it should open IE browser...
这篇关于在Internet Explorer中使用Python进行硒测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!