Reputation: 7692
When I ran my Selenium tests a year ago they worked.
I have since then updated Selenium and Firefox.
Now when I start a test, it fails already at
driver = new FirefoxDriver()
with a
...TargetInvocationException
...--->
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:51672/session timed out after 60 seconds.
Why? Work around?
Firefox starts but nothing loads. The port number (51672) is new for every run.
( I guess downgrading Selenium and FF to their respective older versions, whatever they were, would solve the problem; but that is not a way forward. I also have a vague memory of, earlier, having an old version of Se or FF because it wouldn't work otherwise. )
I have Windows10 x64, Firefox quantum 57.0.4 (64-bit), Selenium v.3.8 and dotnet 4.6.1.
Upvotes: 0
Views: 1285
Reputation: 2573
Since Selenium 3.0 you also need to download the geckodriver.exe from the below url as per your system configuration.
https://github.com/mozilla/geckodriver/releases
Then you can try something like this:
//Give the path of the geckodriver.exe
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\Users\abcd\Downloads\geckodriver-v0.13.0-win64","geckodriver.exe")
//Give the path of the Firefox Browser
service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
IWebDriver driver = new FirefoxDriver(service);
driver.Navigate().GoToUrl("https://www.google.com");
You may need to or there's ways to specify the geckodriver as an environment variable as well.
Upvotes: 1