javascript error when running selenium test suite

A strange problem occurred when I was running one of my selenium test suites. The test would run fine for my first testcase (that is, the first “method”). If you know a little about how selenium works, you’ll know that the teardown method is called after each method.
The teardown basically grabs any errors that occurs and kills the browser session, thus opening a new session in your next method. The issue that was occurring was this annoying JavaScript error being pulled from Internet Explorer, saying it cannot run scripts on the page. It halted my script and I had no way to get to the following methods…so after a little digging around I found a solution…

All you need to do, is replace your current teardown method with this

    def teardown
		@selenium.close
		@selenium.stop
    assert_equal [], @verification_errors
  end

That should fix it…
enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>