TestStack / TestStack.Seleno

Seleno helps you write automated UI tests in the right way by implementing Page Objects and Page Components and by reading from and writing to web pages using strongly typed view models.
http://teststack.github.com/TestStack.Seleno/
MIT License
180 stars 60 forks source link

Test fails on Firefox 45.0.1 #244

Closed DanielSundberg closed 8 years ago

DanielSundberg commented 8 years ago

After updating from Firefox 44.0.2 to 45.0.1 my tests fail with the following error (references to my source code removed):


1) Test Error : MyTest
   System.TypeInitializationException : The type initializer for 'MyStaticSelenoHostInitializer'
threw an exception.
  ----> Autofac.Core.DependencyResolutionException : An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055 (See inner exception for details.)
  ----> OpenQA.Selenium.WebDriverException : Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055
   at AppBaseClass() in ....cs:line 9
   at TestStack.BDDfy.StepActionFactory.<>c__DisplayClass4`1.b__3(Object o)
   at TestStack.BDDfy.StepExecutor.Execute(Step step, Object testObject)
   at TestStack.BDDfy.Processors.AsyncTestRunner.Run(Func`1 performStep)
   at TestStack.BDDfy.Processors.ScenarioExecutor.ExecuteStep(Step step)
   at TestStack.BDDfy.Processors.ExceptionProcessor.Process(Story story)
   at TestStack.BDDfy.Engine.Run()
   at SomeMethod() in ...cs:line 16
--DependencyResolutionException
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at TestStack.Seleno.Configuration.SelenoApplication..ctor(IContainer container) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\SelenoApplication.cs:line 41
   at TestStack.Seleno.Configuration.AppConfigurator.CreateApplication() in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\AppConfigurator.cs:line 50
   at TestStack.Seleno.Configuration.SelenoHost.CreateApplication(Action`1 configure) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\SelenoHost.cs:line 104
   at TestStack.Seleno.Configuration.SelenoHost.Run(Action`1 configure) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\SelenoHost.cs:line 0
   at ....cctor() in ....cs:line 42
--WebDriverException
   at OpenQA.Selenium.Firefox.FirefoxDriverServer.ConnectToBrowser(TimeSpan timeToWait)
   at OpenQA.Selenium.Firefox.FirefoxDriverServer.Start()
   at OpenQA.Selenium.Firefox.FirefoxDriverCommandExecutor.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(FirefoxBinary binary, FirefoxProfile profile)
   at ....<.cctor>b__4() in ...cs:line 28
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Execute() in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in C:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\PageObjects\Actions\PageReader.cs:line 0


Some other issues says that everything works with Selenium 2.53, for eaxmple: https://github.com/SeleniumHQ/selenium/issues/1851 http://stackoverflow.com/questions/36063908/selenium-2-50-not-working-on-firefox-45/36265777 https://github.com/SeleniumHQ/selenium/issues/1900

However, updating to Selenium.Support/webdriver to 2.53 doesn't fix my problem. I don't want to reopen the selenium issue without checking with you first.

So in Firefox add-ons panel I get this, guess it has something to do with this issue?

2016-04-07 10_21_09-clipboard

Have they packaged the wrong version of the Firefox webdriver? I guess this is not a Seleno problem but I would not like to close until someone acknowledge that this is a problem (which has not happened in the threads over at the Selenium repo).

I'm using nuget packages: Teststack.Seleno 0.9.56 (also tried with 0.9.11) Selenium.Support/WebDriver 2.53 (also tried with 2.50, default dependency for Seleno 0.9.56 and 2.46.0)

DanielSundberg commented 8 years ago

So in Firefox add-ons panel I get this, guess it has something to do with this issue?

2016-04-07 10_10_58-add-ons manager

robdmoore commented 8 years ago

Yeah that's not going to help :P

Did it work again after re-enabling it?

On Thu, Apr 7, 2016 at 4:11 PM, Daniel Sundberg notifications@github.com wrote:

So in Firefox add-ons panel I get this, guess it has something to do with this issue?

[image: 2016-04-07 10_10_58-add-ons manager] https://cloud.githubusercontent.com/assets/1454200/14344634/11ea71be-fca9-11e5-874f-6acddeee22a0.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/TestStack/TestStack.Seleno/issues/244#issuecomment-206750839

DanielSundberg commented 8 years ago

I can't find a way to enable the add-on. More people seem to have the same problem:

http://sqa.stackexchange.com/questions/17892/selenium-web-driver-and-mozilla-firefox-compatibility https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/selenium-users/jGd9qlKOliI/aqFDAQRJAwAJ

robdmoore commented 8 years ago

Have you tried upgrading the selenium nuget packages to the latest version to see if that helps?

The other option is to uninstall Firefox, find an older installer and turn off automatic updates.

On 25 Apr 2016, at 1:31 pm, Daniel Sundberg notifications@github.com wrote:

I can't find a way to enable the add-on. More people seem to have the same problem:

http://sqa.stackexchange.com/questions/17892/selenium-web-driver-and-mozilla-firefox-compatibility https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/selenium-users/jGd9qlKOliI/aqFDAQRJAwAJ

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

DanielSundberg commented 8 years ago

Yes, that's in my first post. I know I can install an older version which I already tried, but that's not an option when you use that browser for your daily web browsing.

I just wanted to know if this is an acknowledged bug and if there is a plan to fix the issue. I know now it's not a Seleno only issue but I can't find any related Selenium issue to track.

pawelpabich commented 8 years ago

Latest seleno brings Selenium 2.50 which does not work with FF 46. Latest version of Selenium 2.53, fixes the probelm

adamg-globale commented 8 years ago

Hi Guys,

I'm getting the same error using Selenium 2.53 in .Net (via nuget) and FF 45.0.1. Tried different combinations of versions of Selenium (2.53, 2.52) and FF (latest, 46.x, 45.x). All have the same problem. Executing on a micro AWS instance running windows R3. ChromeDriver works running the same code.

Be happy to hear if anyone has successfully resolved this.

Cheers, Adam.

mwhelan commented 8 years ago

I found that updating to Selenium 2.5.3 resolved the issue for both FF 45.0.1 and 46.

I have updated Seleno to use Selenium 2.5.3 and we will look to release to NuGet soon.

DanielSundberg commented 8 years ago

As I pointed out in a previous comment my problem seem to be that Firefox no longer is compatible with the selenium add-in. @mwhelan, I guess you've got a working Firefox add-in with 2.53? Did you have to do anything special to get that working? I installed Selenium 2.53 "manually" via nuget but Firefox still didn't get the correct version of the add-in.

Also, as far as I can tell the Firefox add-in is injected into Firefox by Selenium when a test session is started, is this correct?I cant find any documentation on how this is supposed to work or how to troubleshoot...

pawelpabich commented 8 years ago

@DanielSundberg , think this is a red herring. Selenium 2.53 + FF 46.01 work for me and this is what I can see under extensions tab: image

mwhelan commented 8 years ago

@DanielSundberg, I created a test project with Seleno installed from NuGet, which adds Selenium WebDriver 2.50.1 as a dependency. I got the same error reported here when I ran my tests against FF 45.0.1. I updated the WebDriver package to the latest 2.53 and it fixed the issue and worked correctly with Seleno. I then updated FF to 46 and my tests also run successfully with that.

Yes, the Firefox WebDriver comes from Selenium WebDriver. The other browsers have independent webdrivers.

DanielSundberg commented 8 years ago

@mwhelan, ok what you describe did not work for me.

Although I might have had another instance of Firefox running while updating Seleno. I will try this once again with a system restart in between to rule out any hanged processes or similar things.

DanielSundberg commented 8 years ago

So I tried a few more things.

None of this make this work. I have made sure that all old Selenium files are deleted. I still get version 2.48 of the addin loaded into Firefox.

If I look at the file created under C:\Users\dasun\AppData\Local\Temp\anonymous.23910f1f67d443819508836abee8b1a8.webdriver-profile\extensions\fxdriver@googlecode.com\install.rdf it looks like this:

<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">

    <Description about="urn:mozilla:install-manifest">
        <em:id>fxdriver@googlecode.com</em:id>
        <em:version>2.48.0</em:version>
        <em:type>2</em:type>
        <em:name>Firefox WebDriver</em:name>
        <em:description>WebDriver implementation for Firefox</em:description>
        <em:creator>Simon Stewart</em:creator>
        <em:unpack>true</em:unpack>

        <!-- Firefox -->
        <em:targetApplication>
            <Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>3.0</em:minVersion>
                <em:maxVersion>45.0</em:maxVersion>
            </Description>
        </em:targetApplication>

        <em:targetPlatform>Darwin</em:targetPlatform>
        <em:targetPlatform>SunOS</em:targetPlatform>
        <em:targetPlatform>FreeBSD</em:targetPlatform>
        <em:targetPlatform>OpenBSD</em:targetPlatform>
        <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform>
        <em:targetPlatform>Linux</em:targetPlatform>

        <!-- We're probably missing lots of platforms here -->
    </Description>

</RDF>

Max version of Firefox handled is 45.0, clearly this won't work for me. How can I get the correct install.rdf file to load?

Looking at Selenium code at label 2.53.0 this is not the code I should get: https://github.com/SeleniumHQ/selenium/blob/selenium-2.53.0/javascript/firefox-driver/extension/install.rdf

pawelpabich commented 8 years ago

@DanielSundberg can you create a new Win VM and try there?

DanielSundberg commented 8 years ago

On Monday I will ask my team mate to try this out on Firefox with Selenium 2.53, I think my issue is related to the upgrade and I don't think he's been running the test suite with Firefox/Selenium-2.48.

I guess we could close this since it's not a Seleno issue at all. However, I would like to understand how I can debug why I get an invalid version of the Firefox add-in injected even when using 2.53 and how I can make my system pick up the correct version of the add-in without reinstalling Windows.

adamg-globale commented 8 years ago

Hi Guys,

Just want to update with my progress in case anyone else runs into the same problem. In fact, Selenuim is run via a testing service I created and therefore is run by the application pool identity user of IIS.

The solution came by setting the 'load user profile' to true in the advanced settings of the application pool.

I have a feeling this different to the cause of the error you guys are experiencing. But we all got here due to the same generic error message.

Hope this may help someone in the future...

Enjoy!

robdmoore commented 8 years ago

Nice - thanks for reporting back; glad you sorted out your problem.

On 8 May 2016, at 11:47 pm, adamg-globale notifications@github.com wrote:

Hi Guys,

Just want to update with my progress in case anyone else runs into the same problem. In fact, Selenuim is run via a testing service I created and therefore is run by the application pool identity user of IIS.

The solution came by setting the 'load user profile' to true in the advanced settings of the application pool.

I have a feeling this different to the cause of the error you guys are experiencing. But we all got here due to the same generic error message.

Hope this may help someone in the future...

Enjoy!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

mwhelan commented 8 years ago

I've released Seleno 0.9.61 which supports the latest Selenium WebDriver 2.53.0.

DanielSundberg commented 8 years ago

I finally solved this. What I did was to clean my project from anything Seleno or Selenium related. Doing this I discovered that I had a webdriver.xpi in my source tree. This was of course where the old version of the Firefox add-in came from...

After cleaning my project I did the following:

> install-package selenium.webdriver
> install-package selenium.support
> Install-Package teststack.seleno

Now I tried to run the Firefox test and get the following error:

System.TypeInitializationException : The type initializer for 'MyProj.UITestAutomationHost' threw an exception.
  ----> Autofac.Core.DependencyResolutionException : An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Cannot find a file named 'C:\Code\....\bin\Debug\webdriver.xpi' or an embedded resource with the id 'WebDriver.FirefoxExt.zip'. (See inner exception for details.)
  ----> OpenQA.Selenium.WebDriverException : Cannot find a file named 'C:\Code\..\bin\Debug\webdriver.xpi' or an embedded resource with the id 'WebDriver.FirefoxExt.zip'.

Why do I get this error? Searching for the error message doesn't give me any useful results. If this was an issue with selenium I think more people would have ran into this?

I remember now that when I set this up the first time I had to find a prebuilt webdriver.xpi somewhere. Today I could find a new one in the following repo: https://github.com/gempesaw/Selenium-Remote-Driver/tree/master/lib/Selenium/Firefox

Placing this file in my output dir solves the issue for me...

I also tried to create a new project from scratch, installing Seleno and Selenium and now everything works fine. I guess there must be some kind of problem with how my particular project is set up (I have code to run tests in IE, Firefox, Chrome and PhantomJS).

Guess this issue could be closed. Thanks for motivating me to dig deeper and find out the root cause.

robdmoore commented 8 years ago

Weird. I've never needed extra files to run web driver against Firefox. Not sure why you need it...

Glad you solved your problem though!

On 9 May 2016, at 6:09 pm, Daniel Sundberg notifications@github.com wrote:

I finally solved this. What I did was to clean my project from anything Seleno or Selenium related. Doing this I discovered that I had a webdriver.xpi in my source tree. This was of course where the old version of the Firefox add-in came from...

After cleaning my project I did the following:

install-package selenium.webdriver install-package selenium.support Install-Package teststack.seleno Now I tried to run the Firefox test and get the following error:

System.TypeInitializationException : The type initializer for 'MyProj.UITestAutomationHost' threw an exception. ----> Autofac.Core.DependencyResolutionException : An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Cannot find a file named 'C:\Code....\bin\Debug\webdriver.xpi' or an embedded resource with the id 'WebDriver.FirefoxExt.zip'. (See inner exception for details.) ----> OpenQA.Selenium.WebDriverException : Cannot find a file named 'C:\Code..\bin\Debug\webdriver.xpi' or an embedded resource with the id 'WebDriver.FirefoxExt.zip'. Why do I get this error? Searching for the error message doesn't give me any useful results. If this was an issue with selenium I think more people would have ran into this?

I remember now that when I set this up the first time I had to find a prebuilt webdriver.xpi somewhere. Today I could find a new one in the following repo: https://github.com/gempesaw/Selenium-Remote-Driver/tree/master/lib/Selenium/Firefox

Placing this file in my output dir solves the issue for me... Guess this issue could be closed. Thanks for motivating me to dig deeper and find out the root cause of this issue.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub