0

My selenium tests are all failing on initalisation with this error.
{"The system cannot find the file specified"}

My initialisation code is really simple:

public static class Host
{
    private static readonly SelenoHost SelenoHost = new SelenoHost();
    static Host()
    {
        Instance.Run(
            configure => configure
                .UsingLoggerFactory(new ConsoleFactory())
                .WithWebServer(new InternetWebServer("http://localhost:9000/")));

        Instance.Application.Browser.Manage().Window.Size = new Size(1500, 1000);
    }
    public static SelenoHost Instance => SelenoHost;
}

}

Firefox is installed in the default location, (C:\Program Files (x86)\Mozilla Firefox\firefox.exe) and is updated to the latest version (42). I am using Windows 10 Operating System.

I am using studio 2015.1

If it helps, this is the stack trace.

   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at OpenQA.Selenium.Firefox.Internal.Executable.LocateFirefoxBinaryFromPlatform()
   at OpenQA.Selenium.Firefox.Internal.Executable..ctor(String userSpecifiedBinaryPath)
   at OpenQA.Selenium.Firefox.FirefoxBinary..ctor(String pathToFirefoxBinary)
   at TestStack.Seleno.Configuration.BrowserFactory.<FireFox>b__b() in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\BrowserFactory.cs:line 73
   at TestStack.Seleno.Configuration.WebDriverBuilder`1.CreateWebDriver() in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\WebDriverBuilder.cs:line 88
   at TestStack.Seleno.Configuration.BrowserFactory.FireFox() in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\BrowserFactory.cs:line 73
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
Sergey Litvinov
  • 7,408
  • 5
  • 46
  • 67
Jim
  • 14,952
  • 15
  • 80
  • 167
  • I really expected this to have a quick resolution. There appears be no comprehensive documentation for test stack configuration. Is it not widely used? Are there good alternatives? This all started after a recent update – Jim Dec 06 '15 at 13:16

1 Answers1

1

I have discovered that this is possibly a bug.

I have discovered that supplying a WebDriver, and default Profile seems to alleviate the problem. This solution allows a single instance of Firefox to run. If an existing instance is present (open) then a different error is thrown when creating the driver.

An exception of type 'OpenQA.Selenium.WebDriverException' occurred in 
WebDriver.dll but was not handled in user code

Additional information: 
Unable to bind to locking port 7054 within 45000 milliseconds

As long as you make sure all firefox instances are closed prior to running the tests, this code works:

Instance.Run(
    configure => configure
         .WithRemoteWebDriver(
               () => new FirefoxDriver(
                new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"), 
                new FirefoxProfile()))
         .UsingLoggerFactory(new ConsoleFactory())
         .WithWebServer(new InternetWebServer("http://localhost:9000/")));
Jim
  • 14,952
  • 15
  • 80
  • 167