Tag Archives: Firewatir

Finding a form by xpath in Firewatir causes ‘Stack Level Too Deep’

If in a firewatir script you look for a form using xpath, you’ll get the following output: SystemStackError: stack level too deep from /Library/Ruby/Gems/1.8/gems/firewatir-1.6.2/lib/firewatir/htmlelements.rb:72:in `locate’ from /Library/Ruby/Gems/1.8/gems/firewatir-1.6.2/lib/firewatir/MozillaBaseElement.rb:1012:in `exists?’ from /Library/Ruby/Gems/1.8/gems/firewatir-1.6.2/lib/firewatir/MozillaBaseElement.rb:965:in `assert_exists’ from /Library/Ruby/Gems/1.8/gems/firewatir-1.6.2/lib/firewatir/MozillaBaseElement.rb:1403:in `method_missing’ from /Library/Ruby/Gems/1.8/gems/firewatir-1.6.2/lib/firewatir/htmlelements.rb:75:in `locate’ from /Library/Ruby/Gems/1.8/gems/firewatir-1.6.2/lib/firewatir/MozillaBaseElement.rb:1012:in `exists?’ … Continue reading

Posted in Automated Testing, WATIR | Tagged , , , | Leave a comment

How to quit Firefox using FireWatir on a Mac

There seems to be a bug in the way that FireWatir on the mac quits firefox… it doesn’t! When you try, you end up with a dialog box saying: Close Firefox A copy of Firefox is already open. Only one … Continue reading

Posted in Automated Testing, Example Code, Ruby, Tools, WATIR | Tagged , , , , , , | Leave a comment

How to know if you have a secure session in Watir

Sometimes you’re on a secure page, sometimes you’re not. How to know? There’s a very simple method you can write to find out, based on the browser’s current url. Here’s the method: def is_session_secure? @browser.url =~ /^https/ ? true : … Continue reading

Posted in Example Code, Ruby, Test::Unit, WATIR | Tagged , , , , , , | Leave a comment

How to get only direct child objects in Watir

When you come across methods in watir that return child objects for the first time (eg: the ‘lis‘ in @browser.ul(:id,’main’).lis ) you’d think they’d return only the direct child objects. Frustratingly, they don’t. They’ll also return nested objects of the … Continue reading

Posted in Automated Testing, Example Code, Making Life Easier, Ruby, Tools, WATIR | Tagged , , , , , | Leave a comment

How to check for errors on every page using Watir

Testing a web app in an unstable environment is a pain. Many tests will fail for environmental reasons and filtering out those results can take a while. To make this sort of thing less painful, Watir and its derivatives (eg: … Continue reading

Posted in Automated Testing, Example Code, Making Life Easier, Ruby, Tools, WATIR | Tagged , , , , , | 1 Comment

Fix for Firewatir visible? method

The visible? method in the ruby Firewatir 1.6.2 gem isn’t great. After some hunting around, I ended up here and found a working monkeypatch. Here’s the code: class Element def visible? assert_exists jssh_command = "var val = ‘true’; var str … Continue reading

Posted in Automated Testing, Example Code, Ruby, Tools, WATIR | Tagged , , , , , , , | Leave a comment

FireWatir JSSH “Unable to connect” – FIXED!

Firewatir is awesome. But… sometimes Firefox takes too long to load (eg: if you have loads of plugins) causing firewatir to timeout and give the following error: Unable to connect to machine : 127.0.0.1 on port 9997. Make sure that … Continue reading

Posted in Automated Testing, Example Code, Ruby, Tools, WATIR | Tagged , , , , , , | 2 Comments