我正在尝试运行 Selenium 测试。我正在使用 C#。我尝试过的每个驱动程序都存在问题。
Chrome
var options = new OpenQA.Selenium.Chrome.ChromeOptions();
options.BinaryLocation = @"C:\Users\Vilem\AppData\Local\Google\Chrome\Application\";
using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(options))
{
...
似乎找到了 chromedriver.exe,但它可以找到 Chrome 二进制文件。自动搜索失败后,我明确设置了 chrome.exe 的路径。我什至最后用“chrome.exe”尝试过。我总是得到相同的结果:
无法在以下位置找到 Chrome 二进制文件:
C:\Users\Vilem\AppData\Local\Google\Chrome\Application
Firefox
new OpenQA.Selenium.Firefox.FirefoxDriver();
我还尝试使用配置文件集:
FirefoxProfile profile = new FirefoxProfile(@"E:\...\FirefoxProfile");
new OpenQA.Selenium.Firefox.FirefoxDriver();
我收到的错误:
45000毫秒内无法绑定锁定端口7054
IE
var ieOptions = new InternetExplorerOptions();
ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
new InternetExplorerDriver(@"C:\Program Files (x86)\IEDriver\", ieOptions);
包含驱动程序的文件夹也在 PATH 中设置。
我收到的错误:
No response from server for url http://localhost:6955/session
我有什么遗漏的吗?如果他们中的任何一个能够工作,我会很高兴。
Thanks