开发者

The remote server returned an error: (401) Unauthorized when using any site

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开发者_如何学JAVA");

However, I get an error stating:

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

Anyone have any ideas why?

Thanks


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜