Watir clicks buttons on a web page by looking at the attributes available in the
HTML Buttons
What you see in the web browser:"button" id="one" name="clickme" value="Click Me">
id Attribute
This is the Watir code you need to click a button using the id attribute:ie.button(:id, "one").click
name Attribute
This is the Watir code you need to click a button using the name attribute:ie.button(:name, "clickme").click
value Attribute
This is the Watir code you need to click a button using the value attribute:ie.button(:value, "Click Me").click
Image Buttons
tag looks like an image, but acts like a button. Like HTML buttons it can be accessed by id, name and value attributes. Image buttons can also be accessed by their src attribute.src Attribute
What you see in the web browser:"image" src="images/doit.gif">
ie.button(:src, /doit/).click
No comments:
Post a Comment