WebDriver使用IE和chrome浏览器
因为我用的是 selenium-dotnet-2.47.0.zip
IEDriverServer_x64下载地址
https://code.google.com/p/selenium/downloads/list?can=1&q=&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCount
https://code.google.com/p/selenium/downloads/detail?name=IEDriverServer_x64_2.39.0.zip&can=1&q=
chromedriver下载地址
http://chromedriver.storage.googleapis.com/index.html?path=2.4/
https://code.google.com/p/chromedriver/downloads/list?can=1&q=
谷歌会出现unable to discover open pages,要将之放置在chrome 安装目录下 然后设置环境变量看看 本人略懒 不去测试了
IWebDriver driver = new ChromeDriver("J:\\vs2010_lin_projects\\chromedriver_win32_2.3");
--------------------------------
开始使用Selenium2之后就一直在用FireFox,因为文章上都说webdriver对firefox支持的最好,同时也很好上手,试了一下就可用了,也就没再用其他浏览器,不过最近遇到了一个问题,是我不得不考虑尝试一下其他浏览器,尤其是IE,下面就说说我的尝试过程。
开始,仍然像使用firefox一样new一个实例,IWebDriver driver = new InternetExplorerDriver(),这个绝对没问题,编码时没有提示和报错,因为这个类是webdriver类库中提供的,同时还包括其他各种浏览器的,但是一运行就报错,错误是“The IEDriverServer.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://selenium-release.storage.googleapis.com/index.html.”,这是提示我要下载IEDriverServer.exe,这好像不同于FireFox,我觉得FireFox如果找到合适的版本(我现在用的是10)好像不用安装任何插件,可以直接支持,于是我就在网上找了一个IEDriverServer.exe,开始不知道怎么用,以为像Selenium1中使用remote server一样要双击运行这个exe程序,可是不行,仍然报错,我就开始根据错误信息乱猜了,是不是要配置环境变量啊,网上还说这个exe文件要放在什么特定的路径下啊,最后试了一下IWebDriver driver = new InternetExplorerDriver(“IEDriverServer.exe的路径”),这样就好了,不报之前的错了,也无需双击运行,不过要注意这个路径只写路径就好,不要写带文件名。新的错误又出现了“Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (NoSuchDriver)”,还好,网上对这个错误有比较准确的解决方案,就是IE浏览器关闭保护模式,所有四种情况的保护模式都要关闭,照做之后就不报错了,其他的代码可以不动,直接运行即可,不过网上说IE执行起来很慢,我觉得也是。顺便说一下,本来想尝试一下IE的初衷并没有因此而得到解决,因为IE也出现一样的问题,看来得换个思路,不能靠换浏览器了。
A[%7BT()W%7B1.png)

WebDriver使用IE和chrome浏览器的更多相关文章
- webdriver高级应用- 禁止Chrome浏览器的PDF和Flash插件
#encoding=utf-8 from selenium import webdriver # 导入Options类 from selenium.webdriver.chrome.options i ...
- webdriver高级应用- 使用Chrome浏览器自动将文件下载到指定路径
#encoding=utf-8 from selenium import webdriver import unittest, time class TestDemo(unittest.TestCas ...
- atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结
atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结 1. 常见标准 1 1.1. 录制重放 1 1.2. 一个窗体一个proxy cookie 1 1.3. exec ...
- 爬虫动态渲染页面爬取之selenium驱动chrome浏览器的使用
Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样,可以用其进行网页动态渲染页面的爬取. 支持的浏览器包括IE(7, 8, 9, 10 ...
- selenium webdriver启动Chrome浏览器后无法输入网址的解决办法
通过selenium webdriver启动Chrome浏览器,脚本如下: from selenium import webdriver browser = webdriver.Chrome() br ...
- selenium webdriver 使用Chrome 浏览器
首先需要有ChromeDriver驱动来协助.ChromeDriver是实现WebDriver有线协议的一个单独的服务.ChromeDriver通过chrome的自动代理框架控制浏览器,ChromeD ...
- 【Selenium专题】WebDriver启动Chrome浏览器(二)
官方API Constructor Summary ChromeDriver() Creates a new ChromeDriver using the default server configu ...
- 【Selenium专题】WebDriver启动Chrome浏览器(一)
selenium操作chrome浏览器需要有ChromeDriver驱动来协助.一.什么是ChromeDriver?ChromeDriver是Chromium team开发维护的,它是实现WebDri ...
- Python3 + selenium + Chrome浏览器(webdriver.Chrome()报错)
Python3 + selenium + Chrome浏览器 Error: selenium.common.exceptions.WebDriverException: Message: 'chrom ...
随机推荐
- 小demo--横向+展开菜单,支持m站
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- c++ 定义宏常量
#ifndef __GAME_DATA_H__ #define __GAME_DATA_H__ #ifndef GAME_IS_CREATE_SHOP #define GAME_IS_CREATE_S ...
- Faster-R-CNN编译使用及相应问题解决
1.首先opencv是需要安装的,我用的ubuntu14.04,opencv3.0,具体安装教程可以参考网上很多,不想多提. 2.安装几个依赖包:cython,python-opencv和easydi ...
- CentOS6.3添加nginx系统服务详细说明
今天虚拟机上配了下服务器整理了个这个 nginx 服务 要注意 - 短横杠这个符号看看复制进去后有没有乱码,我之前就遇到这个问题,郁闷了好久才发现 提示:顶部的注释不要去除否则无法注册为系统服务, 关 ...
- Mapreduce参数调节
http://blog.javachen.com/2014/06/24/tuning-in-mapreduce/ 本文主要记录Hadoop 2.x版本中MapReduce参数调优,不涉及Yarn的调优 ...
- Debug / Inspect WebSocket traffic with Fiddler【转】
Introduction I have recently written a project using SignalR, which supports HTML 5 WebSocket. Howe ...
- /tmp 和 /var/tmp 的区别
/tmp is meant as fast (possibly small) storage with a short time to live (TTL). Many systems clean / ...
- Linux随笔(安装ftp,安装jdk,安装 tomcat,安装redis,安装MySQL)
su: authentication failure 解决办法:sudo passwd root 更改密码即可 确认虚拟机用到的联网方式是桥接模式,不然Windows是ping不通Linux的,确保 ...
- Windows系统新建gitignore文件出现“必须键入文件名”错误的解决办法
今天打算把本地的项目用git推送到github上去,但是有的信息我又不想把它加入到版本控制系统中去,例如.classpath文件和.class文件等等,这个时候我就想到了使用.gitignore文件把 ...
- PHP中使用CURL(六)
curl常用的几个例子 1.抓取无访问控制文件 <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://local ...