0

I'm using the following configuration:

  • Win 10 64-bit
  • VS Enterprise 2017
  • C# testing project
  • Firefox 53.0.3 (64-bit)
  • Gecko driver geckodriver-v0.16.1-win64
  • Selenium.WebDriver v3.4.0

and this snippet:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;

namespace Test
{
    class Program
    {
        static void Main(string args)
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://www.google.com");
        }
    }
}

When I run this program the Gecko driver starts and displays this:

1496673391949 geckodriver INFO Listening on 127.0.0.1:62736 1496673393128 geckodriver::marionette INFO Starting browser \\?\C:\Program Files\Mozilla Firefox\firefox.exe with args ["-marionette"]

A Firefox page is opened but after a while a timeout error is displayed:

timeout

Could you please tell me what I did wrong?

spender
  • 117,338
  • 33
  • 229
  • 351
VASY MHR
  • 1
  • 2
  • Check the Firefox version and the selenium drivers and gecko. Check if they are compatible with each other. – Souvik Ghosh Jun 06 '17 at 10:18
  • I've got no problems with ChromeDriver() in the same configuration. – VASY MHR Jun 06 '17 at 10:19
  • But you have to check the compatibility for Firefox – Souvik Ghosh Jun 06 '17 at 10:20
  • all the versions are in the description. Seems to work but I can't connect to the internet with gecko. So I left browser opened after run test and tried to connect to google.com but I gotthe same error. it seems that marionette can't connect to internet. Is there any port I miss or any special configuration ? – VASY MHR Jun 06 '17 at 10:21
  • Check if this helps- http://ccm.net/forum/affich-3788-connection-has-timed-out-firefox – Souvik Ghosh Jun 06 '17 at 10:24
  • this seems to be the problem but each time I run the test the new window is launched with wrong proxy settings. How can I solve this? I need somehow to edit marionette proxy settings – VASY MHR Jun 06 '17 at 10:30
  • any idea how to set proxy settings for gecko/marionette ? – VASY MHR Jun 06 '17 at 10:35
  • I see there is another question for this already but no answers : https://stackoverflow.com/questions/37774403/setup-proxy-in-firefox-browser-via-marionette-driver – VASY MHR Jun 06 '17 at 10:37

2 Answers2

0
FirefoxProfile profile = new FirefoxProfile();
Proxy proxy = new Proxy();
proxy.IsAutoDetect = true;
profile.SetProxyPreferences(proxy);
IWebDriver driver = new FirefoxDriver(profile);
driver.Navigate().GoToUrl("http://www.google.com/");
VASY MHR
  • 1
  • 2
0

I had an exact same issue and after a day of hard work I finally figured out the issue.

You need to install the following with the exact versions:

  1. C# Selenium Binding: 3.11.0
  2. Gecko Driver: v0.19
  3. Firefox version: 55

This not only resolved my issue of no internet connection but also the problem of instantiating the FirefoxDriver. Following is the code I used for instantiating the Firefox Driver

var driverDir = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(driverDir, "geckodriver.exe");
service.HideCommandPromptWindow = true;
service.SuppressInitialDiagnosticInformation = true;
FirefoxOptions options = new FirefoxOptions();
IWebDriver Driver = new FirefoxDriver(service,options, TimeSpan.FromMinutes(1));

The same is being pointed out here However, when you update Firefox to v59 or above you will see the same issue occurring once again.