开发者

how to Clear or replace contents of input field using selenium?

开发者 https://www.devze.com 2023-01-16 05:14 出处:网络
How can i clear the contents of an input field using ruby selenium? i.e when page loads up there are values in the input filed but i want to replace them with new开发者_JAVA技巧 ones.

How can i clear the contents of an input field using ruby selenium?

i.e when page loads up there are values in the input filed but i want to replace them with new开发者_JAVA技巧 ones.

thank you


Come on guys... You can't be serious...

With selenium to clear an input field do this: selenium.type("") in ruby too.

And backspacing as many times as there are letters... Come on.. you don't do stuff like that.

Or in Ruby syntax: @browser.type "idofthefield", ""


This is how i cleared and replaced with new text in my Ruby based web portal test

@driver.find_element(:xpath, "//input[@name='ip-address']").clear
@driver.find_element(:xpath, "//input[@name='ip-address']").send_keys(new_ip_address)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号