使用Chrome驱动程序查找元素

哈泽姆

我正在以编程方式将驱动程序chrome用于单击按钮,但无法访问chrome.exe

static IWebDriver driverchromeDriver;
    public void chromeDriver()
    {
        driverchromeDriver = new ChromeDriver(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe");
        driverchromeDriver.Navigate().GoToUrl("http://www.google.com");
        driverchromeDriver.FindElement(By.Id("lst-ib")).SendKeys("qwe");
        driverchromeDriver.FindElement(By.Id("lst-ib")).SendKeys(OpenQA.Selenium.Keys.Enter);
    }

但它显示此问题:其他信息:文件C:\ Program Files(x86)\ Google \ Chrome \ Application \ chrome.exe \ chromedriver.exe不存在。可以从http://chromedriver.storage.googleapis.com/index.html下载该驱动程序

耶罗恩

显然,它在您在构造函数中指定的目录中期望有一个名为“ chromedriver.exe”的文件。“ chromedriver.exe”似乎已在中硬编码ChromeDriver如果您通过提供的链接下载chromedriver.exe并将代码更改为:

driverchromeDriver = new ChromeDriver(@"path where chromedriver.exe is located");

它应该工作。

附带说明:chromedriver.exe与Chrome不同。Chrome是实际的浏览器,chromedriver.exe也是用于自动化测试的实际WebDriver。因此,我不会将chromedriver.exe其与Chrome放在同一目录中。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

驱动程序查找元素

在 element selenium python chrome 驱动程序中查找元素

旧元素参考:元素未使用chrome Web驱动程序附加到页面文档

如何使用JavaScript使用Selenium Web驱动程序API查找后代元素?

如何查找Selenium网格上的节点正在使用的Chrome驱动程序版本

MongoDB使用Node.js本机驱动程序在查找排序结果中间获取元素

我们如何使用Selenium Web驱动程序查找元素的数量

使用XCUITEST驱动程序在Appium中通过xpath查找元素

使用Selenium Chrome驱动程序自动“另存为PDF”时缺少元素

Chrome 驱动程序:动态 div 元素在哪里?

Python Selenium Chrome 驱动程序找不到元素

使用 Wix 安装 Windows 驱动程序 - DifxAppExtension - 意外的子元素“驱动程序”

使用MongoDB .Net驱动程序查找POCO

如何强制Chrome使用WebSA的Mesa软件驱动程序

如何使用 selenium Web 驱动程序单击元素(Python)

如何使用硒驱动程序单击元素?

查找已安装的JDBC驱动程序

查找用于背光控制的驱动程序

如何在使用chrome驱动程序/ firefox驱动程序时更改Webdriver中的文件下载位置

在 selenium web 驱动程序中查找 web 元素时的多个条件

Python:Selenium驱动程序:查找“文本大小”大于“ X”的元素

Nvidia驱动程序问题,未使用驱动程序

多个 chrome 驱动程序实例

Python Selenium Chrome Web驱动程序

Selenium Chrome驱动程序74.0.3729.6问题

Chrome 驱动程序无法找到网页上的元素,即使我之前已经验证过

无法通过 xpath 通过 selenium chrome 驱动程序单击 Web 元素

Java-Selenium(chrome驱动程序)元素不可见异常

chrome驱动程序量角器角度2不可单击的元素