[Selenium] 应对使用 Internet Explorer Driver 多个实例时的 cookie 共享问题
在使用 IEDriverServer 可执行文件时,从理论上来说是可通过它来创建并使用多个同时存在的 Internet Explorer Driver 实例的。但在实际使用过程中,总是会碰到与 cookie 相关的问题、窗口焦点的问题、浏览器多实例等可能会面临的问题。如果真想希望使用 Internet Explorer Driver 的多个实例并且尽可能的避免前述可能遇到的问题,建议考虑 RemoteWebDriver 的方式,并通过多台虚拟机来隔离干扰
有一种解决方案来应对使用 Internet Explorer Driver 多个实例时的 cookie 共享问题,即在Internet Explorer 启动时先清理回话中的脏数据。可通过将 IE_ENSURE_CLEAN_SESION 参数传递给 Internet Explorer Driver 并在此模式下启动 Internet Explorer Driver 来达到目的,代码如下
pachage com.learningselenium.simplewebdriver;
import org.openqa.selenium.*;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class testInternetExplorerDriver{
public static void main(String[] args){
System.setProperty("webdriver.ie.driver", "D:\Driver\IEDriverServer_ Win32_ 2.37.0_latest\IEDriverServer.exe");
//设置DesiredCapabilities 的属性包含IE_ENSURE_CLEAN_SESSION 以确保在浏览器实例启动之前清理会话的脏数据
DesiredCapabilities capab = DesiredCapabilities.internetExplorer();
capab.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
Webdriver driver = new InternetExplorerDriver(capab);
driver.get("http://www.baidu.com");
}
}
[Selenium] 应对使用 Internet Explorer Driver 多个实例时的 cookie 共享问题的更多相关文章
- [Selenium] 配置 Internet Explorer Driver 的注意事项
1)请确保 IEDriverServer 的可执行文件在系统环境变量PATH 中 2)在IE7 和以上版本的 Internet Explorer 上,必须确保保护模式的正确配置.设置方式为 Tools ...
- Selenium WebDriver问题--Internet Explorer保护模式设置问题
在用WebDriver中打开Internet Explorer访问百度的是,报下面错误: org.openqa.selenium.remote.SessionNotFoundException: Un ...
- Selenium2学习-037-WebUI自动化实战实例-IE浏览器显示比例问题:org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Browser zoom level was set to 94%. It should be set to 100%
好久没有写博文了,今天在给部门新人演示 Selenium WebDriver 启动其支持的各种浏览器时,启动 IE 时总是无法打开对应的百度网址,页面如下所示:
- 解决selenium 启动ie浏览器报错:Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones
启动ie代码: System.setProperty("webdriver.ie.driver", "bin/IEDriverServer.exe"); Web ...
- 【解决问题】failed: java.lang.RuntimeException: org.openqa.selenium.WebDriverException: Unexpected error launching Internet Explorer.
failed: java.lang.RuntimeException: org.openqa.selenium.WebDriverException: Unexpected error launchi ...
- selenium启动IE失败,并报错:Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones
1.selenium去启动IE时,报错: Started InternetExplorerDriver server (32-bit)2.50.0.0Listening on port 24641On ...
- 【Python + Selenium】初次用IE浏览器之报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones.
初次用IE浏览器运行自动化程序时,报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launchi ...
- python3+selenium使用浏览器IE的时候,无法打开IE浏览器,老是报错: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones
python3+selenium使用浏览器IE的时候,老是报错: Unexpected error launching Internet Explorer. Protected Mode settin ...
- Internet Explorer Developer Channel 自动化测试 IE 浏览器
IE 原生 Web Driver 调用,通过简单配置,即可自动化测试 IE 浏览器(目前仅限 Internet Explorer Developer Channel 版本).做一些自动化的操作,都是很 ...
随机推荐
- 关于整合spring+mybatis 第三种方式-使用注解
使用注解 1.与前两种方法一致.不过稍许不同的是beans.xml中配置的差异. <!-- 配置sqlSessionFactory --> <bean id="sqlSes ...
- centos 关于防火墙的命令
CentOS7默认的防火墙不是iptables,而是firewalle. 安装iptable iptable-service #先检查是否安装了iptables service iptables st ...
- BZOJ——2096: [Poi2010]Pilots
http://www.lydsy.com/JudgeOnline/problem.php?id=2096 Time Limit: 30 Sec Memory Limit: 162 MBSubmit: ...
- TOT 傅立叶变换 FFT 入门
HDU 1402,计算很大的两个数相乘. FFT 只要78ms,这里: 一些FFT 入门资料:http://wenku.baidu.com/view/8bfb0bd476a20029bd642d85. ...
- mysql delete语句不能用别名
在mysql数据库里运行delete语句 delete ’; 发现会报错: [Err] - You have an error in your SQL syntax; check the manual ...
- spark学习(六)Java版RDD基本的基本操作
1.map算子 private static void map() { //创建SparkConf SparkConf conf = new SparkConf() .setAppName(" ...
- win7安装ANT
点击进入ant官网,找到下载选项. 选择下载安装文件.其余的源文件和手册的下载步骤完全相同. 可以下载官网上对应系统的最新版本.也可以在old ant 版本中选择自己需要的版本.笔者需要ant ...
- 【Todo】一些scala的实验 & 与Java的混合
另外,如果要支持 java 和 scala混合build,可以看看这篇文章: http://www.cnblogs.com/yjmyzz/p/4694219.html Scala和Java实现Word ...
- paddle中新增layer
Implement C++ Class The C++ class of the layer implements the initialization, forward, and backward ...
- CMS - 认识目录
Tips:如果网页图片(文字)看不清,请按CTRL+鼠标滚轮 一个完整的小程序模板目录结构如下! 本章节给出的建议: 1.推荐使用flex布局 2.其它图片路径建议引入网络路径(tabBar不支持网络 ...