How to access element with custom attribute using Watir?

I have HTML that looks like this:

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

I would like to enter text in it using Watir.

Answers


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")

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

Sources:


Need Your Help

django: search forms and redirect

python django redirect search-form

After processing form from POST I should redirect, to prevent user from hitting back. However, I am using form to determine search query on a database, so I need to either pass params to the redire...

[a-z]+, [A-Z]+, [0-9]+ and flag commands in awk

regex awk flags

I am trying to understand some commands in awk, which are related to If statement inside awk to change a value question.