如何使用selenium webdriver 3.4.0启动IE浏览器

时间:2017-09-20 10:22:52

标签: selenium webdriver

如何使用selenium webdriver 3.4.0启动IE浏览器?我试过了,但无法打开IE浏览器。我已经下载了IE驱动程序,并且像启动firefox驱动程序一样。

启动Firefox浏览器工作正常,下面是命令行

System.setProperty("webdriver.gecko.driver","C:\\Users\\vidhya.r\\Desktop\\Automation\\Jars\\geckodriver.exe"); FirefoxOptions options = new FirefoxOptions(); options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); driver = new FirefoxDriver(options);

3 个答案:

答案 0 :(得分:0)

下载IEDriverServer,将其置于路径或使用

  

System.setProperty(" webdriver.ie.driver",ieDriverPath);

通过

发布
driver = new InternetExplorerDriver();

答案 1 :(得分:0)

DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
capability.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
capability.setCapability(InternetExplorerDriver.ELEMENT_SCROLL_BEHAVIOR, 1); 
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capability.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);        

System.setProperty("webdriver.ie.driver", ieDriverPath);
WebDriver driver = new InternetExplorerDriver(capability);

答案 2 :(得分:0)

首先从此Link

下载IEDriver

使用此:

System.setProperty("webdriver.ie.driver", "Path of IE driver");
WebDriver driver = new InternetExplorerDriver();

如果您想添加一些功能,请使用DesiredCapabilities