Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get value of element custom attribute with Watir

I have HTML that looks like this:

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

I would like to get value of custom_attribute using Watir.

like image 554
Željko Filipin Avatar asked Sep 18 '09 09:09

Željko Filipin


1 Answers

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

Sources:

  • http://www.mail-archive.com/wtr-general%40rubyforge.org/msg06769.html
  • http://rdoc.info/gems/watir/1.6.6/Watir/Element#attribute_value-instance_method
  • https://github.com/watir/watir-classic/blob/master/lib/watir-classic/element.rb
  • http://zeljkofilipin.com/watir-select-element-using-custom-attribute/
like image 187
Željko Filipin Avatar answered Oct 24 '22 19:10

Željko Filipin