我正在试着让Selenium测试运行。我在用C#。我试过的每一个司机都有问题。
铬
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 ms内的锁定端口7054
即
var ieOptions = new InternetExplorerOptions();
ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
new InternetExplorerDriver(@"C:\Program Files (x86)\IEDriver\", ieOptions);
驱动程序的文件夹也设置在路径中。
我所犯的错误:
No response from server for url http://localhost:6955/session
我遗漏了什么吗?如果他们中有人能工作我会很高兴的。
谢谢
发布于 2012-07-17 11:19:33
我将.exe for ChromeDriver和IE_driver放在项目/bin/文件夹中,从而使Chrome和IE工作。
例如。
VisualStudio2010/Projects/ProjName/ProjName/bin/chromedriver.exe
然后,当我设置测试时,我做了:
using OpenQA.Selenium.Chrome;
...
private IWebDriver chrome;
...
[SetUp]
public void SetupTest()
{
chrome= new ChromeDriver();
baseURL = "url-goes-here";
verificationErrors = new StringBuilder();
}
...
如果还没有下载.exe,可以从这里下载
发布于 2012-07-12 12:39:25
铬
无法在以下位置找到Chrome二进制文件: C:\Users\Vilem\AppData\Local\Google\Chrome\Application
我认为您必须指定整个路径,包括可执行文件。与C:\Users\Vilem\AppData\Local\Google\Chrome\Application\chrome.exe
类似(只是猜测,目前无法访问Windows机器)
Firefox
无法绑定到45000 ms内的锁定端口7054
你不应该永远得到这个。最快速的解决方案,告诉你不问很多问题回来:重新启动(或注销-登录)。如果您在重新启动后仍然得到这一点,请查看有关它的问题,并可能发布您自己的。
发布于 2012-08-06 21:17:05
您应该指定包含.exe的路径。因此,您的代码如下:
options.BinaryLocation = @"C:\Users\Vilem\AppData\Local\Google\Chrome\Application\chrome.exe";
new InternetExplorerDriver(@"C:\Program Files (x86)\IEDriver\iexplore.exe", ieOptions);
https://stackoverflow.com/questions/11456416
复制相似问题