[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 版本).做一些自动化的操作,都是很 ...
随机推荐
- golang文件下载断点续传(下载客户端)
客户端: //const ( // UA = "Golang Downloader from Kejibo.com" //) func DownloadController(ctx ...
- jqeury设置元素屏幕居中
jQuery.fn.center = function () { this.css(“position”,”absolute”); this.css(“top”, ( $(window).height ...
- 一起来学Spring Cloud | 第五章:熔断器 ( Hystrix)
在微服务项目中,一个系统可以分割成很多个不同的服务模块,不同模块之间我们通常需要进行相互调用.springcloud中可以使用RestTemplate+Ribbon和Feign来调用(工作中基本都是使 ...
- 模拟赛QAQ
100 + 30 + 0 T1 叉叉 题目描述 现在有一个字符串,每个字母出现的次数均为偶数.接下来我们把第一次出现的字母a和第二次出现的a连一条线,第三次出现的和四次出现的字母a连一条线,第五次出现 ...
- iOS Block学习
iOS4已经直接支持blocks,很有必要学习一下. 在ios中,将blocks当成对象来处理,它封装了一段代码,这段代码可以在任何时候执行.Blocks可以作为函数参数或者函数的返回值,而其 本身又 ...
- 【Todo】ssh的原理和实践
有空的时候补充,可以参考 http://www.ruanyifeng.com/blog/2011/12/ssh_remote_login.html http://www.ruanyifeng.com/ ...
- poj1159--Palindrome(dp:最长公共子序列变形 + 滚动数组)
Palindrome Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 53414 Accepted: 18449 Desc ...
- 二叉查找树python实现
1. 二叉查找树的定义: 左子树不为空的时候.左子树的结点值小于根节点,右子树不为空时,右子树的结点值大于根节点.左右子树分别为二叉查找树 2. 二叉查找树的最左边的结点即为最小值,要查找最小值.仅仅 ...
- v-model在其它元素以及类型上的用法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 项目Beta冲刺(团队3/7)
项目Beta冲刺(团队3/7) 团队名称: 云打印 作业要求: 项目Beta冲刺(团队) 作业目标: 完成项目Beta版本 团队队员 队员学号 队员姓名 个人博客地址 备注 221600412 陈宇 ...