Sunday, April 17, 2011

Selenium browser detection

Good morning

I have been running a few tests over the past couple of weeks and I have come up against a bit of a wall.

I am testing in IE 7 and 8 and firefox.

Basically my problem is that IE 8 does not yet support a plug in and firefox does not support a referer in a frameset, so basically I want to do is detect which browser I am using and then if its ie 7 run the tests, else skip certain tests, is this possible?

Thanking everyone in advance for their help.

Cheers

Cameron

From stackoverflow
  • Hmmm one solution that came up in my mind... maybe it's a little bit odd, but I think it should work: let your Web app. read the HTTP UserAgent and save it as a hidden HTML input field. Then you can access it from your Selenium tests and decide whether you want to continue running them or not.

    Maybe there's a better solution, I don't know.

  • I might be missing something (probably!) but if all you're trying to do is target tests to IE then would conditional comments work?

    <!--[if ie 7]>
    
        The tests go here.
    
    <![endif]-->
    
  • Just a note for anyone else who reads this: the question is around using Selenium Core and the solution is designed to edit the HTML-based test suite file. If you're using Selenium RC, you obviously know which browser you launched :)

0 comments:

Post a Comment