selenium使用IE浏览器的配置方法

selenium使用IE浏览器的配置方法

步骤:

1.下载IEDriverServer.exe

2.将IEDriverServer.exe放置到IE浏览器安装根目录,如下图

3.打开IE浏览器->设置->Internet选项->安全,将Internet、本地Intranet、受信任的站点、受限制的站点四项的启用保护模式的勾选去掉,如下图


4.修改代码如下

//设置"webdriver.ie.driver"的值为IEDriverServer.exe的路径
System.setProperty("webdriver.ie.driver","C:/Program Files (x86)/Internet Explorer/IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();  //IE

5.完整代码如下图


发布了10 篇原创文章 · 获赞 0 · 访问量 9208
展开阅读全文

Python+Selenium打不开IEDriver,是什么原因呐,求助!!

01-10

【环境信息】 Python3.6+Selenium3.0.2+IE10+win7 【问题描述】 1、用如下代码打不开IE浏览器,但是能打开火狐浏览器 import unittest import os from selenium import webdriver class TestAutoMethods(unittest.TestCase): #打开Firefox浏览器 def test_openbrower(self): browser = webdriver.Firefox() browser.get("http://www.baidu.com") def test_FirstVase(self): #ie_driver = os.path.abspath(r"C:\Program Files(x86)\Internet Explorer\IEDriverServer.exe") #os.environ["webdriver.ie.driver"] = ie_driver browser = webdriver.Ie() browser.get("http://www.youdao.com") if __name__ == '__main__': unittest.main() 2、报错信息 Error Traceback (most recent call last): File "D:\Users\chenle\PycharmProjects\untitled\test\FirstExam.py", line 14, in test_FirstVase browser = webdriver.Ie() File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\ie\webdriver.py", line 57, in __init__ desired_capabilities=capabilities) File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__ self.start_session(desired_capabilities, browser_profile) File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in execute response = self.command_executor.execute(driver_command, params) File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 408, in execute return self._request(command_info[0], url, body=data) File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 478, in _request resp = opener.open(request, timeout=self._timeout) File "C:\Program Files\Python36\lib\urllib\request.py", line 526, in open response = self._open(req, data) File "C:\Program Files\Python36\lib\urllib\request.py", line 544, in _open '_open', req) File "C:\Program Files\Python36\lib\urllib\request.py", line 504, in _call_chain result = func(*args) File "C:\Program Files\Python36\lib\urllib\request.py", line 1346, in http_open return self.do_open(http.client.HTTPConnection, req) File "C:\Program Files\Python36\lib\urllib\request.py", line 1321, in do_open r = h.getresponse() File "C:\Program Files\Python36\lib\http\client.py", line 1331, in getresponse response.begin() File "C:\Program Files\Python36\lib\http\client.py", line 297, in begin version, status, reason = self._read_status() File "C:\Program Files\Python36\lib\http\client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览