Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

I've got some tests where I'm checking that the proper error message appears when text in certain fields is invalid. One check for validity is that a certain textarea element is not empty.

If this textarea already has text in it, how can I tell selenium to clear the field?

something like:


1 Answer

0 votes
by (62.9k points)

Using clear( ) command to clear a text box field


public void clearTheTextBox(){webdriver.findElement(By.xpath(“XXXXXX”)).clear();


Hope this helps! 

Browse Categories