Filipin.eu

Željko Filipin's blog.
Home Blog Tags Now License

View on GitHub
29 January 2007

Watir: Select Element Using Custom Attribute

by Željko Filipin

Paul Rogers and Prema Arya just started a very interesting thread at wtr-general.

If you have text field

<input custom_attribute="so cool" type="text" />

you can get value of custom_attribute

browser.text_field(:index, 1).attribute_value("custom_attribute")
#=> "so cool"

and you can set value of that text field using custom_attribute

browser.text_field(:xpath , "//input[@custom_attribute='so cool']/").set("even more cool")
tags: code - ruby