Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如文本框的值为 10 我需要将值更改为 20
当我使用下面的 Capybara 命令时,
fill_in "#{ID}", :with => "20"
该值没有改变......而是附加为1020。
给我你的建议。
我不得不使用javascript来做到这一点。在更改值之前,我编写了一个单独的步骤来清除该字段。
page.execute_script("$('#{field_id}').val('');")
我相信正确的语法是
fill_in "ID", :with => "20"