Internet explorer Selenium WebDriver C#始终无法在Internet Explorer上找到任何内容
我用visual studio 2012 C#和selenium WebDriver编写了一个简单的自动化测试。 它在谷歌浏览器上运行良好(只是有点慢)。 我的代码也必须在Internet Explorer上运行..但是..selenium web驱动程序始终无法找到任何web元素..只有通过id、css、xpath和名称进行搜索 我以为那是我的密码。。但是如果我尝试在谷歌上做一个简单的搜索,我也会遇到同样的问题Internet explorer Selenium WebDriver C#始终无法在Internet Explorer上找到任何内容,internet-explorer,selenium,Internet Explorer,Selenium,我用visual studio 2012 C#和selenium WebDriver编写了一个简单的自动化测试。 它在谷歌浏览器上运行良好(只是有点慢)。 我的代码也必须在Internet Explorer上运行..但是..selenium web驱动程序始终无法找到任何web元素..只有通过id、css、xpath和名称进行搜索 我以为那是我的密码。。但是如果我尝试在谷歌上做一个简单的搜索,我也会遇到同样的问题 using System; using System.Collec
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Environment;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Interactions;
using System.Windows.Forms;
var options = new InternetExplorerOptions();
IWebDriver driver = new InternetExplorerDriver(@"C:\Users\IEDriverServerpath\IEDriverServer.exe", options);
driver.Navigate().GoToUrl("http://www.google.com");
driver.FindElement(By.Id("q")).SendKeys("WebDriver");
Chrome进入google.com并在搜索框中发送“WebDriver”。。
IE在google上运行,但visual studio在“过时元素”错误上“爆炸”。。“找不到id==q的元素”(也使用xpath)
我忘了IE的一些设置了
更新
在PATH中正确设置IEDriverServer,它就工作了..对不起,我是新手..为了使webdriver在windows上与IE一起正常工作,必须在PATH环境变量中设置IEDriverServer.exe位置。噢!正如我在问题中所写的,我是一个硒noob。我正在用它做一些练习(例如学习页面工厂),但我仍然是个呆子。我会研究的