How to delete a single character from input field

  • 1 Replies
  • 947 Views
How to delete a single character from input field
« on: March 23, 2016, 13:13:18 pm »
I want to run a test that deletes a few characters from an input field before my assert call.

For example "Hello Sebastian" to "Hello Seba".

How would I do so with selenium's webdriver ?

*

Oren

  • **
  • 59
Re: How to delete a single character from input field
« Reply #1 on: March 23, 2016, 16:24:27 pm »
You can use the WebElement.sendKeys method which takes an enum of any key in order to send backspace to delete a character.

Code
element.sendKeys(Keys.BACK_SPACE);

 

Sitemap 1 2 3 4 5 6 7 8