Tuesday, October 14, 2008

Use Selenium RC in Firefox 3

How to use Selenium RC in Firefox 3

For a while now i have been told that selenium RC does not work in firefox 3. This is a huge bummer for anyone who wants to run functional tests and has to downgrade to firefox 2.

Edit 1/12/2009:
A new version (1.0 beta 2) of selenium RC was released today that fixes this issue once and for all!
get it here. You shouldnt need to do this hack now, unless you want to use the old non-beta version. If you do need to use the old version of selenium, here is how to get it to run firefox 3:

Edit 2/8/2009:
Today i was told that there is a firefox extension that allows you to turn of extension version checking. Also, you can do it by editing about:config.

Today i found a workaround to this problem, which works, and is really simple.

Here is what you need to do:
1. Open selenium-server.jar using winrar
2. locate 2 dirs: customProfileDirCUSTFFCHROME and customProfileDirCUSTFF
3. recursively explore each of those dirs, and when you find a file called install.rdf drag it to some temp location, and edit the following line:
<em:maxVersion>2.0.0.*</em:maxVersion>
change it to:
<em:maxVersion>4.0.0.*</em:maxVersion>
4. drag the install.rdf back into the archive and overwrite the old one.
5. do this for all the install.rdf files in those 2 dirs.


you can now use "*firefox" in selenium RC. "*chrome" was giving me problems though, complaining about a malformed rdf file, i might have made a mistake in one of them. Either way, i use *firefox, so it does not matter to me.

if you want, you can get my modified selenium jar here - modified to run in firefox3.
the version of selenium that this jar contains are:
selenium.core.version=0.8.3
selenium.rc.version=0.9.2
selenium.rc.revision=2006
selenium.core.revision=1879

also, there is a 1.0-beta1 compatible modified jar here

Edit 12/10/2008:
Some people have been asking for help with selenium errors in the comments. I cannot help you with those, they are probably specific to what you are doing. If you have question about selenium RC errors, you should try asking them on the Selenium RC User Forums.

44 comments:


  1. thanks a lot for your selenium server !

    I had a problem with firefox 3 and selenium server 1.0 beta 1


    18:02:42.615 INFO - Command request: open[http://xxxxxxxx, ] on session null
    18:02:42.615 ERROR - Exception running command
    java.lang.NullPointerException: sessionId should not be null; has this session been started yet?

    but with your modified server, it works fine ;)

    ReplyDelete
  2. I got Firefox3 to work in OSX but not being able to use the *chrome identifier made it impossible for selenium-rc to login (via https) to the website and subsequently run the tests. Sort of defeats the whole purpose. Not sure what to do now..

    ReplyDelete
  3. @john:
    when i use chrome with this hack i get an error about bad syntax. I suspect its because i made a mistake somewhere, and it would probably be easy to fix if you just did all the steps from scratch, and were extra careful. If that does help and you still get the error, you can try to research the chrome rdf file format, and make sure it is correct. Let me know if you figure this out.

    ReplyDelete
  4. EEEE! thank you!!!))
    ps QA

    ReplyDelete
  5. can you let me know how did you change the files and update the jar file again. I extracted the selenium-server.jar file and did changes to all the install.rdf in the two directories,but am having troubles to update the .jar file again for use. I tries updating the jar file using jar-uf option for the files changed, but it doesn't change the jar file. Can you pls let me know how to do it. Thanks.

    ReplyDelete
  6. @Anonymous:
    i changed the files in the jar without unjaring, i used winrar. if you open the jar with winrar you can overwrite files in the jar by dragging and dropping.

    ReplyDelete
  7. Thanks Mikhail! your blog helped in running firefox3 with SRC. And i got the jar file working and changed with WinRaR!!! thanks again :)

    ReplyDelete
  8. On the Mac I had some some sort of checksum issue using "unzip" to decompress the jar and recompress after making the changes. A co-worker suggested using "jar' which eventually worked after I looked at the "-M" option which does not create a manifest file and uses the existing one when you recompress. After that the server worked without error.

    ReplyDelete
  9. Hi Mikhail,
    I get the same error in IE6 after the tests run, which causes a failure. This is my version:
    #Tue Aug 19 13:21:12 CDT 2008
    selenium.core.version=1.0-SNAPSHOT
    selenium.rc.version=1.0-SNAPSHOT
    selenium.rc.revision=1123
    selenium.core.revision=2182

    I couldn't find a comparable file for iexplorer. Have an idea how to fix this one?

    Thanks

    ReplyDelete
  10. Of course only after I post a message do I find the solution.
    Thx

    ReplyDelete
  11. @Anonymous:
    if you end up coming back, let me know the solution please.

    ReplyDelete
  12. Hi Mikhail,

    Your 'modified selenium jar ' was really helpful and I could run my test on FF3.
    As you have mention
    "find a file called install.rdf drag it to some temp location, and edit the maxVersion to 4.0.0".
    I did this but still my test was not running on FF3, after using the modified jar I am able to do the same.

    Jus wanted to know whether you have done anything extra in the modified selenium jar to make it gel with FF3.....?

    Regards,
    Ioh

    ReplyDelete
  13. @Ioh:
    i did exactly what was described in the procedure. I ended up modifying some files inside of the jar. One way to find out what i did exactly, and if i actually did something else would be to unjar my jar, and the original, and do a diff on their contents.

    ReplyDelete
  14. Thanks a lot ! now i can launch Firefox 3 using Selenium RC.

    thanks

    ReplyDelete
  15. Hi,
    I am new to Selenium and I heard from one of my friend that Selenium doesn't support Firefox 1.8 and later versions,even after doing the above changes as "em:maxVersion 2.0.0.*em:maxVersion
    change it to:
    em:maxVersion4.0.0.*em:maxVersion.

    Please help me to fix this issue and I want to use selenium for Firefox 3.X verison.. Thanks in advance..

    ReplyDelete
  16. @Anon:
    if you did exactly what i wrote down, it should work, if not, maybe you can try using my modified jar. If that still does not work you can try contacting me on google chat, my email is koryakATgmail

    ReplyDelete
  17. Fantastic,
    I can't believe that worked.
    Thank you
    Chris

    ReplyDelete
  18. Thanks for the good work !really good.
    Thanks a lot Mikhail,

    ReplyDelete
  19. Thanks for the good work !really good.
    Thanks a lot Mikhail,

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete
  21. Hi Mikhail,

    Unfortunately for me, it doesn't work. I've tried doing the change to install.rdf files in the jar. That didn't work. I also used the selenium-server.jar (1.0 beta 1) that you've attached here. Selenium launches Firefox but then I get the following error: -

    ----------------------------------
    HTTP ERROR: 400

    Could not proxy http://xxx.xxxxx.xxxxx
    java.net.UnknownHostException: xxx.xxxxx.xxxxx

    RequestURI=/

    Powered by Jetty://
    ----------------------------------

    Please help.

    Venky

    ReplyDelete
  22. @Venky:
    if firefox opens that means that the jar works. Usually firefox does not even start, and gets stuck at "setting profile" or something like that. It looks to me like you have an "unknown host" error.

    ReplyDelete
  23. @Venky:
    try opening http://www.google.com - does it still have that error?

    ReplyDelete
  24. image not found error is displayed.

    ReplyDelete
  25. selenium :- when i clicked on drop down or any button then this tool is not recongnized. please help me immediately.

    ReplyDelete
  26. i m using firefox version 2.0
    selenium support for this version.

    ReplyDelete
  27. people,
    i cannot provide help for selenium errors, nor can i provide help "immediately" - this is a blog not a chat room. If you need help on those issues you should try the selenium RC user forums.

    http://clearspace.openqa.org/community/selenium_remote_control/selenium_remote_control_users

    ReplyDelete
  28. THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    It works perfect!

    ReplyDelete
  29. Thank you Mikhail. I tried opening google as well... I get the same error. I'm not sure what else I can do to fix this problem. Any help will be appreciated. Thank you.

    Venky

    ReplyDelete
  30. Just letting you know that we have FF3 fixed in the nightly releases and will be putting out a 1.0 RC or final release that fixes this once and for all. Thanks for your patience and help!

    ReplyDelete
  31. I copied your files but when I executed the tests show me a message "com.thoughtworks.selenium.SeleniumException: Permission denied to get property Window.document"

    ReplyDelete
  32. Thanks for the modified .jar. It worked for me in Intrepid Ibex and Firefox 3. Yippeee!

    ReplyDelete
  33. Just an FYI: We're releasing a new beta of Selenium today that will work with Firefox 3 out of the box. Perhaps you can update this post at the top to indicate that this problem is solved once we get the release out.

    ReplyDelete
  34. @Patrick:
    Thanks for letting me know, ill post a link to the new beta at the top

    ReplyDelete
  35. Hi Mikhail, you are doing an amazing job. Thank you.

    I tried with SRC beta 2 and Firefox 3 - it doesn't work for me. I "Address Not Found" error. Any ideas? Let me know if you need any additional information from me.

    Venky

    ReplyDelete
  36. This comment has been removed by a blog administrator.

    ReplyDelete
  37. hi thanks to ur modified selenium-server.jar,Now I can run selRC with firefox3...
    good work....

    ReplyDelete
  38. can you send me your modified JAR in email, hydhaval@yahoo.com I followed your method but it seems not helping me out. Deeply appreciate your help

    ReplyDelete
  39. @DHAVAL: i fixed the link to my modified jar. You can now download it from here

    ReplyDelete
  40. Thanks a lot.. It was really helpful, saved a lot of time.

    ReplyDelete
  41. It helps also for Firefox 3.5, thanks.

    ReplyDelete
  42. SRC 1.0.1 works with firefox 3.5.2

    ReplyDelete
  43. Hi Friends,
    According to your Suggestion I Run the interactive shell and reach there and give first command as
    you say: [size=18]cmd=getNewBrowserSession&1=*iehta&2=http://www.google.co.in[/size] But
    I got Result a response code of 500 like Below:

    [code]10:08:10.958 INFO - ---> Requesting http://localhost:11111/selenium-server/driver?cmd=getNewBrowserSession&1=*iehta&2=http://www.google.co.in
    10:08:10.967 INFO - Command request: getNewBrowserSession[*iehta, http://www.google.co.in] on session null
    10:08:10.967 INFO - creating new remote session
    10:08:10.971 WARN - GET /selenium-server/driver/?cmd=getNewBrowserSession&1=*iehta&2=http://www.google.co.in HTTP/1.1
    java.lang.RuntimeException: SystemRoot apparently not set!
    at org.openqa.selenium.server.browserlaunchers.WindowsUtils.findSystemRoot(WindowsUtils.java:275)
    at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.findHTALaunchLocation(HTABrowserLauncher.java:42)
    at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.(HTABrowserLauncher.java:28)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(BrowserLauncherFactory.java:124)
    at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.getBrowserLauncher(BrowserLauncherFactory.java:81)
    at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:307)
    at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:113)
    at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:78)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:653)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:410)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:388)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:135)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
    at org.mortbay.http.HttpServer.service(HttpServer.java:909)
    at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
    at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
    Server returned HTTP response code: 500 for URL: http://localhost:11111/selenium-server/driver/?cmd=getNewBrowserSession&1=*iehta&2=http://www.google.co.in
    [/code]

    How this problem can remedy, the selenium RC is running fine , but the problem is that, I am working in
    Fedora core 12 box. Waiting your Fast Reply
    you can reply me at : anes.pa@gmail.com
    Thankfully
    Anes P.A

    ReplyDelete
  44. Awesome solution

    ReplyDelete