如何使用Watir访问具有自定义属性的元素?

Žel*_*pin 4 html internet-explorer watir

我有这样的HTML:

<input custom_attribute="so cool" type="text" />
Run Code Online (Sandbox Code Playgroud)

我想使用Watir在其中输入文本.

bou*_*uby 7

菲律宾的回答对我的watir-webdriver工作不起作用.

但是,我确实找到了使用css选择器完成工作的方法.

browser.element(:css, "input[custom_attribute='so cool']").send_keys("the coolest")
Run Code Online (Sandbox Code Playgroud)