selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Selenium web driver 2.48.2 does not locate firefox in the default directory.

Open jimmymain opened this issue 10 years ago • 13 comments

Package 2.48.2 does not locate the firefox.exe in the default directory any more. It could be relatated to (issue 1287)[https://github.com/SeleniumHQ/selenium/issues/1287]

I have verified this on two different machines, both running studio 2015.1 / Win10. Firefox newly installed in the default location, namely "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"

My suite of tests, which passed recently, are now unable to locate firefox. Firefox is version 42. The latest.

Here 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```

jimmymain avatar Dec 08 '15 05:12 jimmymain

In your stacktrace, I noticed you that are using Seleno - have you tried reproducing this with just Selenium? Try writing a pure selenium test rather than using Seleno.

If you could do that, and validate that this is indeed an issue with us, then we can look into it further

ddavison avatar Dec 08 '15 15:12 ddavison

I have the same problem when trying to run Selenium FirefoxDriver with Nunit on Windows 10. If I create console application Selenium FirefoxDriver runs without the problem.

pedja7 avatar Dec 08 '15 15:12 pedja7

Hi,

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

This has been reported in issue #1307

I am supplying the web driver and profile using this code:

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/")));

jimmymain avatar Dec 09 '15 03:12 jimmymain

Hi guys,

it might be a bit another problem, but I cannot solve it by myself. I'm trying to initiate the FireFox browser after update (v.43) for the tests, but the FirstRun page is showing up every time and all the tests are failed.

So, the question is how to set up the firefox profile correctly inside the Instance.Run? FireFox: the latest v.43 Selenium WebDriver: 2.46.0.0 I think that the main problem for me is to create a correct FireFox profile and to bind it somehow to the code.

Here is my piece of code:

    public static class Host
    {
        public static readonly SelenoHost Instance = new SelenoHost();

        static Host()
        {
            //FirefoxProfile profile = new FirefoxProfile();
            //profile.SetPreference("browser.startup.homepage", "about:blank");
            //profile.SetPreference("startup.homepage_welcome_url", "about:blank");
            //profile.SetPreference("startup.homepage_welcome_url.additional", "about:blank");

            Instance.Run(configure => configure
                //.WithRemoteWebDriver(BrowserFactory.Chrome)
                //.UsingLoggerFactory(new ConsoleFactory())
                .WithRemoteWebDriver(() => new FirefoxDriver(new FirefoxProfile()))
                .WithWebServer(new InternetWebServer("http://www.test.com/")));

            Instance.Application.Browser.Manage().Window.Maximize();
        }
    }

It would be grate if you could help me out! Thanks!

sirj77 avatar Dec 21 '15 14:12 sirj77

If I write like this:

            Instance.Run(configure => configure
                .WithRemoteWebDriver(() => new FirefoxDriver(new FirefoxProfile(@"C:\Users\my_name\AppData\Roaming\Mozilla\Firefox\Profiles\60hwwq8c.ProfileSelenium")))
                .WithWebServer(new InternetWebServer("http://www.test.com/")));

the FireFox instance is run without this firstRun page, but nothing happens..

sirj77 avatar Dec 21 '15 15:12 sirj77

I am also experiencing the error while running tests using C# FirefoxDriver on Win 10, VS 2015 Update 1, ReSharper test runner, xUnit 2.1.0, Selenium 2.48.2, Firefox 43.0.2. Running the tests from command line (with xUnit console runner) works fine. The same code used to work from within Visual Studio.

jussimattila avatar Jan 05 '16 10:01 jussimattila

Same problem System.ComponentModel.Win32Exception : The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() 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 OpenQA.Selenium.Firefox.FirefoxDriver..ctor() at MyProject.Tests.MultiBrowserTest1.InitWebDriver() in D:\Tests\SeleniumTests\MultiBrowserTest.cs:line 83 at MyProject.Tests.MultiBrowserTest1.FixtureSetUp() in D:\Tests.SeleniumTests\MultiBrowserTest.cs:line 47 NUnit Adapter 3.0.8.0 executing tests is finished I use C# FirefoxDriver on Win 10, VS 2015 Update 1, NUnit Adapter 3.0.8.0, Selenium 2.48.2, Firefox 43.0.

I guess it can be somehow related to update of Visual Studio (or Selenium), which I have done yesterday. It is not related to Firefox version, because before VS update tests were working well.

besteffects avatar Jan 14 '16 17:01 besteffects

This is likely fixed by 6b496e6, which will be released in .NET 2.49.0. Since I'm on a boat in the Caribbean at the moment, I'll ask for your patience until I return before asking how soon a fix will be available.

On Dec 8, 2015, at 10:46, pedja7 [email protected] wrote:

I have the same problem when trying to run Selenium FirefoxDriver with Nunit on Windows 10. If I create console application Selenium FirefoxDriver runs without the problem.

— Reply to this email directly or view it on GitHub.

jimevans avatar Jan 14 '16 21:01 jimevans

Thank you. I have just checked the same configuration, but with Windows 7. It works well. So, problem really relates to Windows 10. Have a nice trip!

besteffects avatar Jan 14 '16 23:01 besteffects

If 2.49.0 does not resolve the problem, we can reopen this issue.

jimevans avatar Jan 19 '16 22:01 jimevans

I agree. Now Firefox driver opens, but it does not open my site. Instead, I see following string in Firefox instead of my site opened: about:blank&utm_content=firstrun. I saw this topic http://stackoverflow.com/questions/34054751/selenium-when-new-iwebdriver-is-created-browser-launches-then-closes-then-rela . But, it did not work. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstanceT at TProject.Tests.MultiBrowserTest1.InitWebDriver() in D:\Tests\src\Tests\Tests.SeleniumTests\Tests\MultiBrowserTest.cs:line 83 at Project.Tests.MultiBrowserTest1.FixtureSetUp() in D:\Tests\src\Tests\Tests.SeleniumTests\Tests\MultiBrowserTest.cs:line 47

besteffects avatar Jan 20 '16 11:01 besteffects

I have fixed it by downgrading Firefox from version 43 to 42 and then upgrading it to v.43 again.

besteffects avatar Jan 21 '16 16:01 besteffects

Try removing com.google.guava_1.6.0 if that is included in your libraries and it should work

hgrules avatar Jul 29 '16 10:07 hgrules