尝试使用 watir-webdriver 和 chrome 设置 text_field 时出错

Error when trying to set text_field using watir-webdriver and chrome

我将黄瓜与 ruby 和 watir-webdriver 一起使用。我以前没有遇到过这个问题,其他页面上的 text_fields 工作正常。我试过使用 CSS & name 而不是 ID 但没有成功。在 Chrome 中,有人对造成这种情况的原因以及如何解决这个问题有任何想法吗?

使用 Firefox 时不会出现该错误。

脚本:

@session.text_field(:id, 'officialTitle').when_present.set("Test 1")

html:

<input id="officialTitle" name="official_title" server-validation="" class="form-control ng-pristine ng-invalid ng-invalid-required ng-touched" ng-model="profile.study.official_title" required="" type="text">

错误:

Selenium::WebDriver::Error::UnknownError: unknown error: a.tagName.toUpperCase is not a function
(Session info: chrome=46.0.2490.80)
(Driver info: chromedriver=2.17.340128
(994135a3538dd99439ef22cea8a9b098e00d8eb4),platform=Mac OS X 10.11.0 x86_64)

结果是另一个 ID 为 tagName 的元素导致了问题,即使没有与该元素进行交互。更改该 ID 解决了我的问题。