使用Selenium webdriver作为Internet Explorer。测试不会运行 [英] Using Selenium webdriver for Internet Explorer. Tests won't run

查看:786
本文介绍了使用Selenium webdriver作为Internet Explorer。测试不会运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Selenium Webdriver for IE(IEDriverServer.exe)扩展我的测试来覆盖Internet Explorer。



我的问题是当我使用IE webdriver执行我的测试。当我运行测试时,Internet Explorer webdriver打开,我可以输入地址,但是当涉及到其他脚本的实际执行(例如输入链接,按各种按钮等等)时,测试会因超时而崩溃。



注意:测试按照Chrome和Firefox的预期执行。



编辑:

  try {
driver.findElement(By.id(topmenuImg))。
}
catch(NoSuchElementException ex){
JOptionPane.showMessageDialog(null,Not possible);
}


解决方案

IE Selenium



使用所需的功能并禁用


I'm currently expanding my tests to cover Internet Explorer using Selenium webdriver for IE (IEDriverServer.exe).

My issue is that when I execute my tests using the IE webdriver. When I run the test, the Internet Explorer webdriver opens up and I can enter the address, but when it comes to actually executing the rest of the scripts (e.g. entering links, pressing various buttons and such) the test crashes due to time out.

NOTE: The tests execute as intended on Chrome and Firefox.

EDIT:

    try {           
driver.findElement(By.id("topmenuImg")).click();        
}       
    catch (NoSuchElementException ex) {             
JOptionPane.showMessageDialog(null, "Not possible");        
}

解决方案

IE Selenium

Use Desired Capabilities and disable the protection mode in IE-Browser

// Tomcat:apache-tomcat-7.0.37\webapps\ROOT\iedriver32\IEDriverServer.exe

String dreiverFromServer = "http://localhost:8088/iedriver32/IEDriverServer.exe"
File ietmp = File.createTempFile("iedriver", null).setExecutable(true);
FileUtils.copyURLToFile(new URL( dreiverFromServer ), ietmp);
System.setProperty("webdriver.ie.driver", ietmp.getAbsolutePath());
                     (OR)
System.setProperty("webdriver.ie.driver", "D:\\iedriver64\\IEDriverServer.exe");

DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
ieCapabilities.setCapability("ensureCleanSession", true);
ieCapabilities.setCapability("ignoreZoomSetting", true);
ieCapabilities.setCapability("ignoreProtectedModeSettings", true);
ieCapabilities.setCapability("ignore-certificate-error", true);
ieCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

driver = new InternetExplorerDriver(ieCapabilities);

IE 11 to set a registry entry on the target computer so that driver can maintain a connection

这篇关于使用Selenium webdriver作为Internet Explorer。测试不会运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆