【问题标题】:Selenium - Use InternetExplorerOptions() when initializing RemoteWebDriverSelenium - 初始化 RemoteWebDriver 时使用 InternetExplorerOptions()
【发布时间】:2017-09-22 18:31:03
【问题描述】:

在通过 Selenium 网格初始化远程驱动程序时,我试图让 IE 以干净的方式启动每个会话。这个

DesiredCapabilities caps = null;
caps = DesiredCapabilities.internetExplorer();
caps.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
WebDriver driver = new RemoteWebDriver(new URL("http://10.10.22.126:5555/wd/hub"), caps);

不工作,IE 正在使用上一个测试中的 cookie 开始每个新测试,这会导致问题。我正在尝试实现这一点

InternetExplorerOptions ieOptions = new InternetExplorerOptions()
                .destructivelyEnsureCleanSession();

按照here 的指示,但我不知道如何将其用作远程驱动程序而不是本地驱动程序。谢谢!

【问题讨论】:

  • 是否将此ieOptions 设置为功能不起作用?

标签: java selenium selenium-iedriver


【解决方案1】:

您可以通过以下方式将该选项设置为一项功能:

InternetExplorerOptions ieOptions = new InternetExplorerOptions()
         .destructivelyEnsureCleanSession();
capabilities.setCapability("se:ieOptions", ieOptions); 

InternetExplorerOptions 类将此功能的常量定义为:

private final static String IE_OPTIONS = "se:ieOptions";

【讨论】:

  • 有趣。你能告诉我这是在做什么吗?
  • @kroe761 这会将选项设置为您的驱动程序的能力之一。
  • 嗯,是的,但我想知道"se:ieOptions" 比什么都重要。我从来没有遇到过。
  • @kroe761 你可以在 InternetExplorerOptions 类中找到它。
猜你喜欢
  • 2014-02-11
  • 1970-01-01
  • 2013-09-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多