0

I am a newbie to Selenium and this doubt might be basic. I have an input element of type text which has some default value but i need to clear that value and insert a new value.

Can somebody help please? Thanks in advance.

abhinavvv
  • 45
  • 2
  • 9

2 Answers2

3

In webdriver you can use the clear command

@d = Selenium::WebDriver.for(:remote, :url => "http://localhost:8080/wd/hub/")
@d.navigate.to <your site>
@d.find_element(:name, "username")
@d.clear() #clears any text that was in the username field
@d.send_keys ("user") #enters the new text
Jeff Sanders
  • 135
  • 1
  • 1
  • 5
1

It would be more helpful if you post question with code snippet. Anyhow, short answer.

selenium.type("//input[@name='INPUTNAME']","NEW VALUE");
ch4nd4n
  • 4,110
  • 2
  • 21
  • 43