Monday, November 09, 2009

IE8 and Selenium RC: Tests won't execute

Just noticed that running tests through Selenium RC in Internet Explorer 8 (IE8) displays a message containing an info to disable pop-up blocker. IE reports a script error and also says that it cannot load "...htmlutils.js". The solution was simple: Run the Selenium RC server in admin mode. Launch the command line as administrator then start selenium RC using "java -jar selenium-server.jar". The scripts should then run. (Of course you would put all of this into a short script or batch file, which in turn is set to run "As Administrator". I observed this behavior on Windows Vista Ultimate 32 bit with IE8 and all of that updated to the latest patch level. The Selenium version was 1.0.1. The behavior might also be present in other combinations. Also the solution described above may or may not help on other tech stacks.

21 comments:

Anonymous said...

Thanks! It's nice solution.

Anonymous said...

YEEEEEEAAAAAAAAAAHHHHHHHHH! Thank you! I've been searching for a while for this!

Anonymous said...

hello
i tried the same thing, i have window vista 32 bit and IE8, changed o admin cmd prmpt for RC server, am getting the following error when executing my java test scripts:

com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://www.google.com Response_Code = 12017 Error_Message = Unknown
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:335)
at com.pooja.learnselenium.whatHappened.testinitialiseSeleniumRCServer(whatHappened.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

can you please help.

many thanks

Manfred Lange said...

@anonymous: Hard to tell. Are you behind a firewall or a router? If so, did you try opening a URL that is on your side of the firewall, e.g. on localhost? If localhost works then you need to look into your network configuration. If this doesn't help, please try the Selenium Users Group for more.

Manfred Lange said...

@anonymous: Here is another thought: In case you are running these tests from within Eclipse: Are you running Eclipse as an administrator? If not, then usually all processes launched from within it do not have administrative rights and you are at square one.

Anonymous said...

many thanks for your reply. starting Eclipse in admin mode did help , website gets launched. However the test fails on selenium.open command.


The error that I am now getting has been posted on google forums but I have been unable to find a satisfactory reply.


Pls if you can , have a look at the error stack below.

Many thanks for your help!

com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://www.google.com Response_Code = 12017 Error_Message = Unknown
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:335)
at com.pooja.learnselenium.whatHappened.testinitialiseSeleniumRCServer(whatHappened.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Manfred Lange said...

@anonymous: I'm afraid that I haven't run into this particular issues yet. Unfortunately I don't have an answer to this.

Anonymous said...

many thanks for your help and Time anyways.

Shem Cristobal, PMP said...

Many Thanks Manfred! You saved me tons of headache! I've been trying to figure out a solution for two days and simply given up then joined the user group hoping someone out there encountered and solved it. It was you! Thanks again!

Ashish said...

Thanks so much Manfred.. I was struggling for so long with this issues, your fixed worked like a charm.. God bless!

Anonymous said...

I have the same problem, but my other problem is I have saved my selenium server in D drive
I run the command prompt as admin but when i tryy to run selenium server it says unable to run jar file
I change to D and try to give the path to selenium server but it says path not found, pls help

Manfred Lange said...

@Anonymous: Your issue is probably unrelated to the blog post. However - and this might be obvious - make sure your D drive is not a mapped network path. I've found that on some Windows 7 boxes paths some commands on the command line show unexpected behavior like not finding a path when you work from within a mapped drive.

Ayoub said...

very helpful thank you

hitesh said...

Thanks. Running as Admin fixed the issue. Windows 7 64 bit, IE8.

Petro said...

not working for me ! windows 7 IE8

Anonymous said...

Hi,
I am executing my testscripts but dont know why the IE gets hanged.
System Config: (Win XP,2GB RAM,IE8)

Thanks

Anonymous said...

Hi,

Some times while using the selenium command IsTextPresent("Test") the time taken is too much.
Why ?
Is there any other replacement for this ?

Thanks

Manfred Lange said...

@Anomymous While I try to craft my blog posts so that solutions are generic I am not in a position to provide technical support in specific cases. If you need assistance may I suggest a site like StackOverflow?

QA_NERD said...

Manfred,
I have the same issue though I am running the project locally on my ubuntu laptop and run the tests on my windows 7 vm using ip address. I am not using grid to run my test. Simple run the selenium rc server on my windows vm and sample script is on my ubuntu laptop. I tried using *iexplore but keep receiving script error but i found this solution on StackOverflow to run using *iexploreproxy. after that i am not getting script error getting error like "com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window. The error message is: The value of the property 'XPCNativeWrapper' is null or undefined, not a Function object"

this is drving me crazy. I tried selenium group as well , still waiting for result.

Please help if you know the solution.

Thanks
RP

Manfred Lange said...

@QA_NERD I don't have an answer for this. However, maybe the WebDriver version of Selenium helps in diagnosing this particular issue since it cuts out the 'man in the middle' (the Selenium server in this case). That way you may learn more about whether this could be a network related issue. I am speculating here, though.

Anonymous said...

Thanks a lot for the solution. It helped me a lot..

Post a Comment

All comments, questions and other feedback is much appreciated. Thank you!