Text Fields
Watir sets or clears a text field by looking at the attributes available in the HTML tag. Common attributes are id and name. For complete list see HTML Elements Supported by Watir.What you see in the web browser:
"text" id="one" name="typeinme">
There is also a file upload element that looks exactly like a text_field with a "Browse" button to the right. For directions on how to interact with this control. |
id Attribute
Watir code to set the text field with the string Watir World using the id attribute:ie.text_field(:id, "one").set("Watir World")
ie.text_field(:id, "one").clear
name Attribute
Watir code to set the text field with the string Watir World using the name attribute:ie.text_field(:name, "typeinme").set("Watir World")
ie.text_field(:name, "typeinme").clear
No comments:
Post a Comment