Clear text from textarea with selenium (C#)

Clear text from textarea with selenium (C#)

As shown clearly in the script for this example, to clear what is written in a text area using the Selenium WebDriver you need to use element.Clear() where element is the text input.

IWebElement query = driver.FindElement(By.Id("searchInput"));
query.SendKeys("the moon");
query.Clear();

Leave a reply

Your email address will not be published. Required fields are marked*

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.