I'm trying to start selenium with firefox like this:
private void button1_Click(object sender, EventArgs e) { var driver = createFirefoxDriver(); driver.Navigate().GoToUrl("http://duck.com"); } IWebDriver createFirefoxDriver() { var service = FirefoxDriverService.CreateDefaultService(); service.FirefoxBinaryPath = BrowserPath.Firefox; var driver = new FirefoxDriver(service, new FirefoxOptions(), TimeSpan.FromSeconds(180)); driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(120); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(80); return driver; }public class BrowserPath { public static string? Firefox { get { if (m_firefox == null) { m_firefox = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe", "", null) as string; } return m_firefox; } } private static string? m_firefox; }
But i'm getting this error:
OpenQA.Selenium.WebDriverException: 'Cannot start the driver service on http://localhost:53912/'
there's nothing on port 53912 as the command output nothing:
$ netstat -a -o | find "53912"
the geckodriver.exe
is also in the output folder. How do I fix that?