Clear text from text area using selenium WebDriver

0 votes

I have some tests case using which I'm checking that the proper error message appears when the text in certain fields is invalid. 

One check for validity is that a certain text area element is not empty.

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

I used the below code:

driver.get_element_by_id('foo').clear_field()
Jun 20, 2018 in Selenium by Atul
• 10,240 points
21,399 views

1 answer to this question.

0 votes

use the below code:

driver.find_element_by_id('abc').clear();
answered Jun 20, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

0 votes
1 answer

How can I clear the text in a text box using Selenium WebDriver?

Hello Akriti, you can clear the text ...READ MORE

answered May 29, 2019 in Selenium by Anvi
• 14,110 points
1,126 views
0 votes
1 answer

How to type text in a new line inside a text area using Selenium Webdriver?

Hey Unnati, '\n' is usually used to type text ...READ MORE

answered Jun 25, 2019 in Selenium by Abha
• 27,930 points
4,415 views
+1 vote
2 answers

How to get typed text from a textbox by using Selenium Webdriver?

Hey Ashmita, to get the typed text ...READ MORE

answered Jun 24, 2019 in Selenium by Abha
• 27,930 points
11,513 views
0 votes
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
3,531 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,534 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
2,596 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
2,863 views
0 votes
1 answer

Selecting an item from dropdown list using Selenium WebDriver & java

Use the below code: new Select(driver.findElement(By.id("blood-group"))).selectByVisibleText("AB"); You also need ...READ MORE

answered May 8, 2018 in Selenium by Meci Matt
• 9,460 points
3,805 views
0 votes
1 answer

How to enter text into text field using Selenium WebDriver

You can use the same code as ...READ MORE

answered Jul 6, 2018 in Selenium by Meci Matt
• 9,460 points
9,197 views