...">

How to access an element with a custom attribute using Watir?

I have HTML that looks like this:

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

I would like to enter text into it using Watir .

+4
source share
2 answers
 browser.text_field(:xpath , "//input[@custom_attribute='so cool']/").set("even more cool") 

Sources:

+5
source

Answer Filipin did not work for my work with watir-webdriver.

However, I found a way to do work with css selectors.

 browser.element(:css, "input[custom_attribute='so cool']").send_keys("the coolest") 
+7
source

All Articles