[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 版本).做一些自动化的操作,都是很 ...
随机推荐
- SQL自动生成A到Z二十六个英文字母
if object_id('#tempdriveinfo') is not null drop table #tempdriveinfo create table #tempdriveinfo ( [ ...
- Hadoop三种模的安装配置过程
JDK+Hadoop安装配置.单机模式配置 以下操作在SecureCRT里面完成 1.关闭防火墙 firewall-cmd --state 显示防火墙状态running/not running sys ...
- hadoop+yarn+hbase+storm+kafka+spark+zookeeper)高可用集群详细配置
配置 hadoop+yarn+hbase+storm+kafka+spark+zookeeper 高可用集群,同时安装相关组建:JDK,MySQL,Hive,Flume 文章目录 环境介绍 节点介绍 ...
- Maven使用site-deploy(site:deploy)部署通过site生成的文档(Tomcat-WebDAV)
Maven可以通过site生成项目的帮助文档,并且格式为html,那么可以通过site-deploy把文档部署到远端,部署方式支持HTTP/FTP/SCM/WebDAV等. 更多部署方案,参考:htt ...
- Java主线程等待所有子线程执行完毕再执行解决办法(转)
方法一: Thread.join()方法,亲测可行,thread.join()方法 Vector<Thread> ts = new Vector<Thread>(); for ...
- 【Windows7】win7启动 报错 AutoIt错误,不能打开脚本文件
解决方法: 1.开始-->运行-->regedit 2.按照下图 3.
- Windows下Python安装pyecharts
都说pyechart用来可视化好,可是安装的时候各种坑 正常情况是 pip install pyecharts 然后各种报错,找到一种可行的方式 在https://pypi.org/project/p ...
- 内存管理[5]通过 GetProcessHeaps 函数获取了当前进程的堆句柄列表
本例在建立一个新的堆前后分别通过 GetProcessHeaps 函数获取了当前进程的堆句柄列表, 没想到一个最简单的程序也有 5 个堆. 效果图: unit Unit1; interface use ...
- C++ 宏定义与常量
原文: http://blog.csdn.net/t894690230/article/details/50605021 前言:突然想起很久之前上课时被问及C++ 宏定义与常量的区别,仔细了想了想,并 ...
- Qt:解析命令行
Qt从5.2版開始提供了两个类QCommandLineOption和QCommandLineParser来解析应用的命令行參数. 一.命令行写法 命令行:"-abc" 在QComm ...