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.
您如何使用 Watir 在文本框内手动单击?这样我就可以使用该send_keys方法而不是使用该方法来发送密钥text_field.set。
send_keys
text_field.set
如果您想将键发送到特定元素(例如文本字段),则无需先单击它。Watir API 允许您将密钥发送到特定元素。例如:
text_field(:id => 'my_id').send_keys('a')
但是,如果您需要单击元素来启动一些 javascript,请尝试:
text_field(:id => 'my_id').click text_field(:id => 'my_id').send_keys('a')