Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Selenium Browser Drivers
mlybrand
#1 Posted : Wednesday, August 1, 2012 5:10:25 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/1/2012(UTC)
Posts: 1
Location: Olympia, Washington

Hi, I have a test project that is using Selenium to automate UI testing. Selenium uses 3 different browsers to do the automation, with only one of them being default (apparently), which is the Firefox browser (so, when I instantiate a Firefox browser, NCrunch builds the project and runs the tests okay. When I try to use IE or Chrome I get errors like the following:

The file C:\Users\Mark\AppData\Local\NCrunch\6044\17\_ncrunchreferences\chromedriver.exe does not exist. The driver can be downloaded at http://code.google.com/p/chromium/downloads/list

So, my questions are: Where do I put the to driver .exes in my project? -and- How do I tell NCrunch to move those into the appropriate place for it to launch them like it does with the Firefox driver?

Thanks for your help...

Mark
Remco
#2 Posted : Wednesday, August 1, 2012 9:36:46 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Mark,

Thanks for posting!

It looks to me like your chromedriver.exe is being referenced from the test/project using a relative file path. There's no reason why this can't work with NCrunch, but you need to let NCrunch know about the file so that it can copy it to the workspace used for testing.

Under your project-level NCrunch configuration for your test project, add an extra expression to your 'Additional files to include' to the file path of the chromedriver.exe relative to the project file. NCrunch will then include this file using the same relative file path inside your workspace.

I find it interesting that your test is trying to find this driver inside the _ncrunchreferences. This suggests that the test must be using the file location of one of your referenced assemblies in the expectation that this file is always adjacent to it, which likely won't be the case with NCrunch unless you turn on the 'Copy Referenced Assemblies To Workspace' project-level configuration option for your test project.

Hopefully the above two configuration settings will sort this out. I also recommend having a read of the trouble shooting build issues and workspaces wiki pages as this will help you to better understand NCrunch's workspacing behaviour.

Let me know if this does the trick. If not, we'll try something further.


Cheers,

Remco
SteveC
#3 Posted : Wednesday, October 9, 2013 8:50:56 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/9/2013(UTC)
Posts: 12
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
I'm getting a similar error where there is an error when NCrunch runs the test ...
SetUp : OpenQA.Selenium.DriverServiceNotFoundException : The IEDriverServer.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://code.google.com/p/selenium/downloads/list.

But Resharper runs the tests fine
- the NUnit setup instantiates the driver ...
[SetUp]
public void Setup()
{
_driver = new InternetExplorerDriver();
}

I've tried adding the IEDriverServer.exe in the "Additional files to include" configuration, but still failing ...

Checked the workspace, and the IEDriverServer.exe is there in both the project directory and the \bin\debug directory

However NCrunch will run the test ... if I put the IEDriverServer.exe in my PATH, but that's not going to help anyone else who runs the test :-(
Remco
#4 Posted : Wednesday, October 9, 2013 10:42:18 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Steve, thanks for posting!

The first thing I would check very thoroughly here is to make sure that the IEDriverServer.exe file is in the same directory as Selenium is expecting to find it. NCrunch's workspacing can create an obscure situation where the bin\debug directory of your test project is not necessarily the same bin\debug directory of the other projects being referenced by your test project.

The exception message suggests that the file is being searched for in the current directory. The test runner will usually set the current directory as equal to the bin\debug directory of the test project. There may be a way you can establish for certain whether the file is in the right place by just writing a simple test inside the same test project:

[Test]
public void CheckIfFileExists()
{
Assert.That(File.Exists("IEDriverServer.exe"));
}

If the logic searching for the file doesn't give you any easy options, it is actually possible to set the PATH environment variable inside the test process to include an extra search location. If the file is always at a known location relative to the test's bin\debug directory, you could drop this on the PATH prior to the driver being instantiated. Another option could be to reference the IEDriverServer.exe in its original solution location by using the data provided by the NCrunch environment class, although I would only suggest this as a last resort as it can impact NCrunch's workspace isolation.
1 user thanked Remco for this useful post.
SteveC on 10/9/2013(UTC)
SteveC
#5 Posted : Wednesday, October 9, 2013 1:07:22 PM(UTC)
Rank: Member

Groups: Registered
Joined: 10/9/2013(UTC)
Posts: 12
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Remco,

thanks for the prompt response

I've tried the unit test to check ...

(a) the existence of the IEDriverServer.exe ...
- both Resharper test runner and NCrunch find it

(b) the current directory ...
- as expected, Resharper is looking at the location in my dev tree, and NCrunch at the location in its current work space

So baffled as to why Resharper is working and NCrunch isn't ??

But for now I've stuck a copy of the driver in my PATH and NCrunch is working Ok
Remco
#6 Posted : Wednesday, October 9, 2013 10:01:00 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Many of NCrunch's features derive from it's ability to separate projects from their parent solution and shadow them inside workspaces. The idea behind this is that while it is in the workspace, the project relies only on files that exist within the workspace. This is to prevent the concurrently running tests from interfering with each other or other activities on your machine (i.e. if you were to test your application manually, it could run safely side-by-side with tests that NCrunch are running). There are also many performance advantages, as NCrunch is able to build projects while they are being used for test execution.

Because the unit test checking for IEDriverServer.exe has passed, I have a feeling that the error message given to you by the selenium driver may be a misleading one. The file clearly exists in the current directory. It may be that the driver is looking for the file in the same directory as the DLL performing the searching, in which case it may be possible to get this working by setting the 'Copy referenced assemblies to workspace' setting to 'TRUE' for all the projects in your solution. Although, to be honest, your workaround by using the PATH is probably a better approach. The 'Copy referenced assemblies to workspace' setting disables many of NCrunch's build shortcuts and will greatly slow response times during testing.
1 user thanked Remco for this useful post.
SteveC on 10/10/2013(UTC)
SteveC
#7 Posted : Thursday, October 10, 2013 8:59:05 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/9/2013(UTC)
Posts: 12
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Thanks again for the prompt response Remco ... yeah, I think for now I'll go with the "quick & dirty" approach :-)

Cheers,
SteveC.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.056 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download