使用硒webdriver运行IE浏览器

使用硒webdriver运行IE浏览器

问题描述:

如果有人可以帮助下面的代码使用硒webdriver运行IE浏览器

包IEProjects;

import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver;

public class startIE { 



      public static void main(String[] args) { 

       System.setProperty("webdriver.ie.driver", "C:\\IEDriverServer_Win32_3.3.0\\IEDriverServer.exe"); 
       WebDriver driver = new InternetExplorerDriver();    
       driver.get("http://www.google.com"); 

      } 

     } 

而且我得到下面的结果

Started InternetExplorerDriver server (32-bit) 
3.3.0.0 
Listening on port 29209 
Only local connections are allowed 
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unexpected error launching Internet Explorer. Browser zoom level was set to 150%. It should be set to 100% (WARNING: The server did not provide any stacktrace information) 

它启动IE浏览器,并没有执行该操作。下面是什么被印刷在IE页面

This is the initial start page for the WebDriver server. http://localhost:41380/ 

该错误消息是足够的描述上,有一组先决条件的给IEDriver:

https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration

说明:

  • 浏览器缩放级别必须设置为100%,以便可以将原生鼠标事件设置为正确的坐标。