BrowserSession hangs when creating new instance

211 views
Skip to first unread message

Kurt Le Breton

unread,
Feb 18, 2015, 7:08:02 PM2/18/15
to co...@googlegroups.com
This seems like a simple issue, however I'm new to both Coypu and WebDriver! Some assistance would be much appreciated.

I've recently installed Microsoft Visual Studio Community 2013, running on Windows 8.1.
I used NuGet package manager to install Coypu successfully to my testing project.

What I'm finding when trying to run a very simple test is that the code hangs when trying to instantiate a new BrowserSession.
using (var browser = new Coypu.BrowserSession(sc))

Is there some dependency that's not been setup? I have assumed that the NuGet package manager has provided required dependencies. Coypu, WebDriver and WebDriver.Support were all successfully added as references to the project.

The full sample code I'm running is as follows:

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

namespace UnitTestProject1
{
   
[TestClass]
   
public class UnitTest1
   
{
       
[TestMethod]
       
public void TestMethod1()
       
{
           
var sc = new SessionConfiguration
           
{
               
AppHost = "microsoft.com",
           
};
            sc
.Driver = typeof(Coypu.Drivers.Selenium.SeleniumWebDriver);
            sc
.Browser = Coypu.Drivers.Browser.Firefox;
           
using (var browser = new Coypu.BrowserSession(sc))
           
{
                browser
.Visit(@"http://www.microsoft.com/en-au/default.aspx");
           
}
       
}
   
}
}



daniel hegner

unread,
Feb 19, 2015, 3:25:36 AM2/19/15
to co...@googlegroups.com
I think I might be experiencing the same or a similar problem. I took your code and put it into a xUnit test and got the same result.

However, when I changed the browser to HtmlUnit the test fails with:

Test Name:    HighLandPark.UnitChecks.CheckStartPage.StartPageIsUp
Test FullName:    HighLandPark.UnitChecks.CheckStartPage.StartPageIsUp
Test Source:    c:\svnwork\HighlandPark\HighLandPark.UnitChecks\CheckStartPage.cs : line 15
Test Outcome:    Failed
Test Duration:    0:00:15.044

Result Message:    
OpenQA.Selenium.WebDriverException : Unexpected error. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/
html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Hostname</h2>
<hr><p>HTTP Error 400. The request hostname is invalid.</p>
</BODY></HTML>
Result StackTrace:    
at Coypu.ActivatorDriverFactory.NewWebDriver(Type driverType, Browser browser)
   at Coypu.BrowserSession..ctor(SessionConfiguration sessionConfiguration, DriverFactory driverFactory, TimingStrategy timingStrategy, Waiter waiter, UrlBuilder urlBuilder, DisambiguationStrategy disambiguationStrategy, RestrictedResourceDownloader restrictedResourceDownloader)
   at Coypu.BrowserSession..ctor(SessionConfiguration sessionConfiguration)
   at HighLandPark.UnitChecks.CheckStartPage.StartPageIsUp() in c:\svnwork\HighlandPark\HighLandPark.UnitChecks\CheckStartPage.cs:line 23

Bill Darcy

unread,
Jul 20, 2015, 6:31:07 PM7/20/15
to co...@googlegroups.com
me, too. 
my code is very similar to Kurt's and it also hangs creating a "new BrowserSession". 
i'm running VS 2013 update 4 on Windows 8.1
the last lines of the output window are

'vstest.executionengine.exe' (Managed (v4.0.30319)): Loaded 'D:\...\trunk\source\CoypuTests\CoypuTests\bin\Debug\WebDriver.dll'

The thread '<No Name>' (0x1c20) has exited with code 0 (0x0).

The thread '<No Name>' (0x1f38) has exited with code 0 (0x0).

The thread '<No Name>' (0x1880) has exited with code 0 (0x0).

The program '[276] vstest.executionengine.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).


any suggestions would be greatly appreciated.



Dave Heywood

unread,
Oct 23, 2015, 4:20:53 AM10/23/15
to Coypu
At the risk of a "me too" post, I  found Coypu, watched the video, got excited, then spent an hour trying to get the damn unit tests to run. Just got stuck half way through trying to initiate the browser session like all these. 
We are Win8.1, Vs2013 U5
In the end, I dropped back to straight selenium, but really liked the idea of Coypu, but just can't get it to work. :-(

Adrian Longley

unread,
Oct 23, 2015, 4:41:57 AM10/23/15
to co...@googlegroups.com
On Fri, Oct 23, 2015 at 9:09 AM, Dave Heywood <da...@pointbypoint.co.uk> wrote:
At the risk of a "me too" post, I  found Coypu, watched the video, got excited, then spent an hour trying to get the damn unit tests to run. Just got stuck half way through trying to initiate the browser session like all these. 
We are Win8.1, Vs2013 U5

Can you try updating the webdriver locally from your Coypu test project please. So after

> install-package coypu:

do 

> update-package Selenium.Support

Then try again. Might be that you need the latest driver for firefox which in in that package. Or are you using a different browser?

 
In the end, I dropped back to straight selenium, but really liked the idea of Coypu, but just can't get it to work. :-(


On Thursday, 19 February 2015 00:08:02 UTC, Kurt Le Breton wrote:
This seems like a simple issue, however I'm new to both Coypu and WebDriver! Some assistance would be much appreciated.

I've recently installed Microsoft Visual Studio Community 2013, running on Windows 8.1.
I used NuGet package manager to install Coypu successfully to my testing project.

What I'm finding when trying to run a very simple test is that the code hangs when trying to instantiate a new BrowserSession.
using (var browser = new Coypu.BrowserSession(sc))

Is there some dependency that's not been setup? I have assumed that the NuGet package manager has provided required dependencies. Coypu, WebDriver and WebDriver.Support were all successfully added as references to the project.

The full sample code I'm running is as follows:

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

namespace UnitTestProject1
{
   
[TestClass]
   
public class UnitTest1
   
{
       
[TestMethod]
       
public void TestMethod1()
       
{
           
var sc = new SessionConfiguration
           
{
               
AppHost = "microsoft.com",
           
};
            sc
.Driver = typeof(Coypu.Drivers.Selenium.SeleniumWebDriver);
            sc
.Browser = Coypu.Drivers.Browser.Firefox;
           
using (var browser = new Coypu.BrowserSession(sc))
           
{
                browser
.Visit(@"http://www.microsoft.com/en-au/default.aspx");
           
}
       
}
   
}
}



--
You received this message because you are subscribed to the Google Groups "Coypu" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coypu+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adrian Longley

unread,
Oct 23, 2015, 4:58:02 AM10/23/15
to co...@googlegroups.com
On Fri, Oct 23, 2015 at 9:41 AM, Adrian Longley <adrian...@gmail.com> wrote:

On Fri, Oct 23, 2015 at 9:09 AM, Dave Heywood <da...@pointbypoint.co.uk> wrote:
At the risk of a "me too" post, I  found Coypu, watched the video, got excited, then spent an hour trying to get the damn unit tests to run. Just got stuck half way through trying to initiate the browser session like all these. 
We are Win8.1, Vs2013 U5

Can you try updating the webdriver locally from your Coypu test project please. So after

> install-package coypu:

do 

> update-package Selenium.Support

Haven't been any functional changes in Coypu for quite a while and Webdriver has moved on 5 versions, so I've released a new Coypu 2.10.0 which depends on the very latest Selenium.Webdriver, just in case that was the problem.

If anyone knows how to tell Nuget to track the latest version of a dependency, but only for the same major version, let me know and we can make that change in the Coypu nuspec, but I dont think this was possible last time I checked.

Dave Heywood

unread,
Oct 27, 2015, 2:33:35 AM10/27/15
to Coypu
Perfect - worked straight away after that !!!!!
So very happy now. 
Thanks again....

(Also strange though as I am sure I tried different other browser driver too...)
Reply all
Reply to author
Forward
0 new messages