tags:

views:

167

answers:

1

Hi,

I am using Selenium to do some web testing. My code looks like this:

        selenium = new DefaultSelenium("localhost", 80, "*firefox", "http://www.google.co.uk/firefox?client=firefox-a&rls=org.mozilla:en-GB:official"); ;

        selenium.Start();

        selenium.GetText("/html/body[@id='mozilla-com']/div[1]/div[2]/div[2]/h2/span");

However, I get an error stating:

The remote server returned an error: (401) Unauthorized.

Anyone have any ideas why?

Thanks

A: 

It looks like you are running in on port 80 which on Development machine with IIS will have a conflict.

when you start Selenium with java -jar Selenium-Server-Standalone.jar it starts up on Port 4444 by default so if you updated your test to

selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.co.uk/firefox?client=firefox-a&rls=org.mozilla:en-GB:official"); ;

selenium.Start();

selenium.GetText("/html/body[@id='mozilla-com']/div[1]/div[2]/div[2]/h2/span");

It should do what you want. I have a Selenium C# tutorial on my site at http://www.theautomatedtester.co.uk/seleniumtraining/selenium_csharp_nunit.htm that should help you through the process. There are number of tutorials on my site if you get stuck

AutomatedTester