Problem running Firefox in a Scheduled Task in Azure / Windows 2012 R2

72 views
Skip to first unread message

Bruce Axtens

unread,
Jul 19, 2017, 12:23:47 AM7/19/17
to Selenium Users

Context: Microsoft Azure / Windows 2012 R2; C#; Selenium.Webdriver 3.4.0; Selenium.Support 3.4.0; Selenium.WebDriver.GeckoDriver.Win64 0.18.0; Firefox 54.0.1 (64-bit); geckodriver 0.18.0


I'm having enormous difficulty getting the Firefox session to launch inside a Windows Service Scheduled Task. Chrome will do it but I have reasons for using Firefox. I have no problem launching a Selenium-driven Firefox session from a C# exe interactively.


The Scheduled Task is set to "Run whether user is logged on or not", and "Run with highest privilege" is checked.


Part of the code:

	FirefoxProfile fp = new FirefoxProfile(@"C:\web\FirefoxProfiles\Thingo");
	fp.AcceptUntrustedCertificates = true;

	FirefoxOptions fo = new FirefoxOptions();
	fo.Profile = fp;
	fo.LogLevel = FirefoxDriverLogLevel.Debug;
	fo.BrowserExecutableLocation = @"C:\Program Files\Mozilla Firefox\firefox.exe";

	var ts = TimeSpan.FromMinutes(1);

	IWebDriver driver = null;
	try
	{
		driver = new FirefoxDriver(fo);
	}
	catch (Exception E)
	{
		Console.WriteLine(E.Message);
		Environment.Exit(255);
	}


After a minute of running that code I get the following Message:


The HTTP request to the remote WebDriver server for URL http://localhost:51289/session timed out after 60 seconds.


Interestingly, according to Task Manager, geckodriver.exe has --port 51289 on its command line.


I've been trying various combinations of Selenium invocations. None work as expected giving the above error or


Unable to find a matching set of capabilities


which makes even less sense. I've also tried a couple of different versions of Firefox, all to no avail.


Is there some Selenium, Firefox or, for that matter, Windows setting that might be affecting the running of the scheduled task? The task launches, and the binary runs, but Firefox is not launched.

Eric Rajkovic

unread,
Jul 19, 2017, 1:44:19 PM7/19/17
to Selenium Users
You may be facing the issue mentioned in https://groups.google.com/forum/#!topic/selenium-users/P-2zj71WH50

Here is a temp change I did to be able to run with firefox 54.0.1 on my setup:

         capabilities.setCapability("marionette", false);

-        driver = new FirefoxDriver(capabilities);

+        driver = new FirefoxDriver();

Reply all
Reply to author
Forward
0 new messages