【发布时间】:2020-03-06 02:53:23
【问题描述】:
我是使用 C# 的 Selenium 新手。每当我尝试运行简单的代码时,我都会得到:
Exception thrown: 'OpenQA.Selenium.WebDriverException' in WebDriver.dll
每次。
注意:我使用的是 Win 10、Visual Studio 企业版 2015、Selenium 3x 和 Chrome 最新版本。 下面是代码。提前致谢
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Selenium1
{
class Program
{
static void Main(string[] args)
{
//Create the reference
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl("http://www.google.com");
IWebElement ele = driver.FindElement(By.Id("gs_htif0"));
ele.SendKeys("Execute Automation");
}
}
}
得到以下异常:
【问题讨论】:
-
使用错误堆栈跟踪更新问题
-
您是否正确添加了引用?展开并显示您的参考资料和 webdriver 版本。
-
是的,我已经安装了所有参考:参考截图:
标签: c# selenium selenium-webdriver