I wanted to record problems found (and perhaps solved?) while attempting to port a test automation framework from WATIR to WATIR - Webdriver, and a simple blog entry seemed to be the easiest way.
WATIR is far less strict than Webdriver about the classes you use to access objects in the html, presumably this because Webdriver is written in Java(???) and that is derives its tag_name from teh class itself.
If I have a visible object which looks like a button but in the html is actually a link, then WATIR is far more forgiving.
For example;
<a href="http://www.google.com" id="goog">Goto Google</a>
Using id, WATIR allows me several ways to access the object, such as;
@browser.button(:id, "goog")
@browser.link(:id, "goog")
However, with Webdriver, I have to use the class define in the html. Therefore only the following is valid.
@browser.link(:id, "goog") NB. I believe Link is an alias of "a", therefore "a" is valid too
If you were to use "button", you would get the following error;
Watir::Exception::UnknownObjectException: unable to locate element, using {:tag_name=>"button", :id=>"goog"}
This is obviously not a big problem, but as I said, exposes mistakes which WATIR allowed and requires changes if those mistakes were made
Showing posts with label watir webdriver port conversion stronglt strong duck type class Watir Exception UnknownObjectException unable to locate element Watir::Exception::UnknownObjectException:. Show all posts
Showing posts with label watir webdriver port conversion stronglt strong duck type class Watir Exception UnknownObjectException unable to locate element Watir::Exception::UnknownObjectException:. Show all posts
Wednesday, 9 February 2011
Subscribe to:
Posts (Atom)