如何使用C#使用Selenium WebDriver实例化InternetExplorerDriver [英] How to instantiate InternetExplorerDriver with Selenium WebDriver using C#

查看:544
本文介绍了如何使用C#使用Selenium WebDriver实例化InternetExplorerDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

new InternetExplorerDriver();

但是我可以看到如下异常:

But I could see exception as below:

OpenQA.Selenium.DriverServiceNotFoundException was unhandled by user code
  HResult=-2146233088
  Message=The IEDriverServer.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://code.google.com/p/selenium/downloads/list.
  Source=WebDriver
  StackTrace:
       at OpenQA.Selenium.DriverService.FindDriverServiceExecutable(String executableName, Uri downloadUrl)
       at OpenQA.Selenium.IE.InternetExplorerDriverService.CreateDefaultService()
       at OpenQA.Selenium.IE.InternetExplorerDriver..ctor(InternetExplorerOptions options)
       at OpenQA.Selenium.IE.InternetExplorerDriver..ctor()
       at Accelrys.CommonTestFramework.WebActions.WebActionLibrary.CreateSeleniumDriver()

推荐答案

作为例外,您需要根据所拥有的IE下载32位或64位的IEDriverServer,并确保它在我们的路径中可用.就是说,当您在命令行上键入IEDriverServer.exe时,应该可以解决该问题.试试吧

As the exception says, you need to download IEDriverServer either 32 or 64 bit depending on IE you have and make sure it is available in our path. That is when you type IEDriverServer.exe on command line it should be resolved. Try that

这篇关于如何使用C#使用Selenium WebDriver实例化InternetExplorerDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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