How can I get value of element custom attribute with Watir

萝らか妹 提交于 2019-11-30 02:41:51

问题


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.


回答1:


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/


来源:https://stackoverflow.com/questions/1443455/how-can-i-get-value-of-element-custom-attribute-with-watir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!