I have read a lots of guides over internet. Though I am still but stuck in this issue.

I have created a Class Library (.NET Framework)
project called JuiceShopAutomation

where I have installed following Nuget packages:

Selenium.WebdDriver (v3.8.0)<br>
Selenium.Support (v3.8.0)<br>
Selenium.Chrome.WebDriver (v2.33.0)<br>
Selenium.Firefox.WebDriver (v0.19.1)<br>
Selenium.WebDriver.IEDriver  (v3.8.0)<br>
MSTest.TestFramework (v1.2.0)<br>

I have also added following code to Class1.CS

using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;

namespace JuiceShopAutomation
    public class Class1

        public void Go()

            FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\WebDriver", "geckodriver.exe");   
            service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
            IWebDriver driver = new FirefoxDriver(service);



I also have added another project to my solution, a new
Unit Test Project (.NET Framework)
called "JuiceshopTests".
For JuiceShopTests I add the reference Project>Juiceshop Automation where all things are installed.

enter image description here

To the new Unit test project I add following code into the file UnitTest1.cs

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using JuiceshopAutomation;

namespace JuiceshopTests
    public class UnitTest1
        public void TestMethod1()

            var c = new Class1();



Then when I run the unit test it fails and throws the below error:

Test Name:  TestMethod1
Test FullName:  JuiceShopTests.UnitTest1.TestMethod1
Test Source:    C:\Users\XXXXXX\source\repos\Creating an Automated Framework With Selenium\JuiceShopAutomation\JuiceShopTests\UnitTest1.cs : line 12
Test Outcome:   Failed
Test Duration:  0:01:01,3130361

Result StackTrace:  
at System.Net.HttpWebRequest.GetResponse()
   at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
--- End of inner exception stack trace ---
    at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
   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(FirefoxDriverService service)
   at JuiceShopAutomation.Class1.Go() in C:\Users\XXXXXX\source\repos\Creating an Automated Framework With Selenium\JuiceShopAutomation\JuiceShopAutomation\Class1.cs:line 20
   at JuiceShopTests.UnitTest1.TestMethod1() in C:\Users\XXXXXX\source\repos\Creating an Automated Framework With Selenium\JuiceShopAutomation\JuiceShopTests\UnitTest1.cs:line 16
Result Message: 
Test method JuiceShopTests.UnitTest1.TestMethod1 threw exception: 
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:60378/session timed out after 60 seconds. ---> System.Net.WebException: The request was aborted: The operation has timed out.

Could someone help me out?

Thank you in advance

  • 1
    Have you tried just calling the default CreateDefaultSerivce() without params? And what is your Firefox browser version? – HaC Jan 7 '18 at 18:05
  • I think actually I solved it by change geckodriver to an older version then it seems like it works. – XsiSec Jan 8 '18 at 17:57
  • Great! Consider posting and accepting your own answer for others who may run into the same problem. – HaC Jan 9 '18 at 3:04
  • @HaC shall I just post my own answer? then Thank you in advance – XsiSec Jan 9 '18 at 8:20

You don't seem to be running the selenium server or a selenium grid for it to connect to.

Your create method is failing to start or detect the server, this could be for a number of reasons.

Failure to detect means it's probably not running. Failure to start means Permissions or Configuration failure are the most likely.


The solution was to downgrade the geckodriver from 19.01 to 18.00 and also downgrade Mozilla Firefox.

Then it worked as fine!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.