assaf/zombie — pull request #349 by makeusabrew (2012-06-01 13:32:05+00:00)
Title: Check for already valid HTML element in browser.link and browser.button methods

The helper methods invoked by ```pressButton``` and ```clickLink``` weren't checking to see if the selector passed to them was already a valid HTML element. This manifested itself for me when trying to invoke ```pressButton``` with an element I'd already queried from an iframe - the ```browser.button``` helper method returns nothing and hence ```pressButton``` throws an error.

I've simply re-used the logic already present in ```browser.field``` to fix this, and added some tests to cover this behaviour (including one for ```browser.field``` while I was at it). Not 100% convinced the tests are in the right place but it was the best fit I could find.

These fixes enabled me to test link and button submissions from within iFrames.