Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36

Steps to reproduce:

1. resources I used : C# , Selenium , VS 2017, Jenkins , VM machine (windows 10) , Nunit v3.9, geckoDrive v19, firefox v56/57

2. I can execute firefox / chrome browser cases on local machine

3. I can execute chrome browser cases on VM machine

4. Issue : **I can Not execute firefox cases on VM machine and its throwing below error.**


**Error Message**


---------------------------------------------------------------------
firefox implemnetation looks like this in Driver.cs - I tried with various version of Firefox too but none is working on VM

else if(browser.Equals(Constant.Firefox)) {
// driver init from here
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(DrivePath);
service.FirefoxBinaryPath = DrivePath;
var profile = new FirefoxProfile();
profile.AcceptUntrustedCertificates = true;
var options = new FirefoxOptions();
options.AcceptInsecureCertificates = true;
options.Profile = profile;
Instance = new FirefoxDriver(service.FirefoxBinaryPath, options, TimeSpan.FromSeconds(10));
Instance.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

Utility.Logger.Write("***** Firefox Browser has been initialized now *********");
}

--------------------------------
5. We have one certificate for firefox and which has already been taken care locally and on VM

6. I am not sure why automation is not able to start firefox on VM


Actual results:

**Error Message**
OpenQA.Selenium.WebDriverException : Cannot start the driver service on http://localhost:50352/

TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
I am adding few code below where issue is throwing issue
Stacktrace

at OpenQA.Selenium.DriverService.Start()
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(String geckoDriverDirectory, FirefoxOptions options, TimeSpan commandTimeout)
at MPAutomation.Driver.Initialize(String browser) in D:\Workspace.Automation\MPproject\MPAutomation\Utility\Driver.cs:line 79
# code on this line : Instance = new FirefoxDriver(service.FirefoxBinaryPath, options, TimeSpan.FromSeconds(10));
at MPAutomation.BaseTest.Init() in D:\Workspace.Automation\MPproject\MPAutomation\Utils\BaseTest.cs:line 54
#code here : LoginPage.GoTo(Settings.BrowserType); # I am passing "Firefox"
--TearDown
at MPAutomation.Driver.Close() in D:\Workspace.Automation\MPproject\MPAutomation\Utility\Driver.cs:line 117
# Instance.Close();
at MPAutomation.BaseTest.Cleanup() in D:\Workspace.Automation\MPproject\MPAutomation\Utils\BaseTest.cs:line 97



Expected results:

Firefox should launch / invoke on Virtual machine

--------------------------------------------------------------------------------------
I am running through Jenkins. My Jenkins getting all automation code and then building using MSBuild plugin we have in jenkins.
And then copying this Solution file and all other folders to Virtual machine. Thats where I see Chrome is working but Firefox 56/57 do not run.



--------------------------------------------------------------------------------------------------
Yes, If I login to VM then I can run Firefox (manually) using below command on command prompt:

"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "C:\abc\Automation\MAutomation.sln" --work="C:\abc\Automation" --dispose-runners

What I have tried:

1. I tried 32/64 bit gecko driver version as well as multiple firefox browser version
2. I tried executing jenkins cycle through Admin elevel and user level
3. I installed VS 2017 on VM and tried to execute and that worked fine it's just Firefox dont execute or invoke when run though Jenkins
4. I checked all certificate needed
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900