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 ...
随机推荐
- mac关机快捷键
1.Ctrl + 关机:弹出关机提示 2.Ctrl + Option + 关机 : 正常关机快捷键 3.Command + Option + 关机 :进入休眠状态 4.Ctrl + Command + ...
- 用myeclipse 创建maven项目时,生成的项目名中总是包含Maven Webapp
解决办法:新建Maven项目时,展开Advanced-Name template中选择[artifactId]即可
- iOS 10权限崩溃问题
手机升级到iOS10 Beta版本后,再次进行真机调试时会遇见权限崩溃问题,崩溃原因如下:This app has crashed because it attempted to access pri ...
- 自动安装memcached服务端与PHP扩展Memcached
该脚本基于阿里云服务器安装脚本,并只能运用于centos / aliyun os,该脚本使用时,需要与阿里云安装脚本的install.sh放在同一目录下.有缘人切忌乱用: #! /bin/bash # ...
- Idea1.5使用Maven搭建Apache Spark1.6源码阅读环境
1.插件安装,在Idea界面依次:File->settings->plugins,安装Maven 2.下载Spark1.6.2源码,这个在GitHub上下载,具体流程自己百度,很简单 3. ...
- Linux下查看access访问日志IP统计命令
查看 access.Log 文件ip统计 cat access.log |awk '{print $1}'|uniq -c |sort -k1,1nr 去掉r则从高到低 cat access.log ...
- 使用 Spark MLlib 做 K-means 聚类分析[转]
原文地址:https://www.ibm.com/developerworks/cn/opensource/os-cn-spark-practice4/ 引言 提起机器学习 (Machine Lear ...
- 4、Math对象
1.编辑html页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// ...
- javascript 中的console.log的作用
主要是方便你调式javascript用的.你可以看到你在页面中输出的内容. 相比alert他的优点是: 他能看到结构话的东西,如果是alert,淡出一个对象就是[object object],但是co ...
- web小技巧
如内容超出单元格,则隐藏style="TABLE-LAYOUT: fixed" 让弹出窗口总是在最上面: <body onblur="this.focus();&q ...