简体   繁体   中英

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

I'm using cucumber with ruby and watir-webdriver. I've not had this issue before and text_fields on other pages work fine. I've tried using CSS & name instead of ID but no luck. Does anyone have any ideas on what's causing this and how to get around it in Chrome?

The error does not occur when using Firefox.

Script:

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

Error:

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)

Turns out another element with the ID tagName was causing the issue, even though that element was not being interacted with. Changing that ID resolved my issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM