How to access element with custom attribute using Watir?
-
12-09-2019 - |
Question
I have HTML that looks like this:
<input custom_attribute="so cool" type="text" />
I would like to enter text in it using Watir.
Solution 2
browser.text_field(:xpath , "//input[@custom_attribute='so cool']/").set("even more cool")
Sources:
OTHER TIPS
Filipin's answer did not work for my job with watir-webdriver.
I did, however, find a way to do the job with css selectors.
browser.element(:css, "input[custom_attribute='so cool']").send_keys("the coolest")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow