在使用 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 共享问题的更多相关文章

  1. [Selenium] 配置 Internet Explorer Driver 的注意事项

    1)请确保 IEDriverServer 的可执行文件在系统环境变量PATH 中 2)在IE7 和以上版本的 Internet Explorer 上,必须确保保护模式的正确配置.设置方式为 Tools ...

  2. Selenium WebDriver问题--Internet Explorer保护模式设置问题

    在用WebDriver中打开Internet Explorer访问百度的是,报下面错误: org.openqa.selenium.remote.SessionNotFoundException: Un ...

  3. 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 时总是无法打开对应的百度网址,页面如下所示:

  4. 解决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 ...

  5. 【解决问题】failed: java.lang.RuntimeException: org.openqa.selenium.WebDriverException: Unexpected error launching Internet Explorer.

    failed: java.lang.RuntimeException: org.openqa.selenium.WebDriverException: Unexpected error launchi ...

  6. 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 ...

  7. 【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 ...

  8. 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 ...

  9. Internet Explorer Developer Channel 自动化测试 IE 浏览器

    IE 原生 Web Driver 调用,通过简单配置,即可自动化测试 IE 浏览器(目前仅限 Internet Explorer Developer Channel 版本).做一些自动化的操作,都是很 ...

随机推荐

  1. Hdu5921 Binary Indexed Tree

    Hdu5921 Binary Indexed Tree 思路 计数问题,题目重点在于二进制下1的次数的统计,很多题解用了数位DP来辅助计算,定义g(i)表示i的二进制中1的个数, $ans = \su ...

  2. Unity3D游戏开发之C#编程中常见数据结构的比较

    一.前言 Unity3D是如今最火爆的游戏开发引擎,它可以让我们能轻松创建诸如三维视频游戏.建筑可视化.实时三维动画等类型的互动内容.它支持2D/3D游戏开发,据不完全统计,目前国内80%的手机游戏都 ...

  3. BZOJ——1202: [HNOI2005]狡猾的商人

    http://www.lydsy.com/JudgeOnline/problem.php?id=1202 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: ...

  4. codevs——2651 孔子教学——同桌

    2651 孔子教学——同桌  时间限制: 1 s  空间限制: 8000 KB  题目等级 : 黄金 Gold 题解       题目描述 Description 孔子是我国古代著名的教育家.他有先见 ...

  5. Systemtap examples, Network - 4 Monitoring TCP Packets

    http://blog.163.com/digoal@126/blog/static/16387704020131014104256627/   例子来自tcpdumplike.stp脚本, 当tcp ...

  6. win7配置java环境变量

    http://jingyan.baidu.com/article/9f63fb91d87fb0c8400f0e93.html 安装JDK,从Oracel官方网站上下载,也可以通过搜索,进入链接.下载完 ...

  7. JavaScript 层

    代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--& ...

  8. IntelliJ IDEA cannot resolved 处理

    IntelliJ IDEA cannot resolved 处理 学习了:https://stackoverflow.com/questions/21577573/intellij-idea-can- ...

  9. 转:VMware中三种网络连接的区别

    转自:http://www.cnblogs.com/rainman/archive/2013/05/06/3063925.html VMware中三种网络连接的区别   1.概述 2.bridged( ...

  10. BeagleBone Black Industrial 杂谈

    前言 原创文章,转载引用务必注明链接.水平有限一己拙见,欢迎指正. 本文使用markdown写成,为获得更好的阅读体验,推荐访问我的博客原文: ​ 初版BeagleBone Black(Rev A4) ...