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
8,003 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,420 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 in Selenium by Anvi
• 13,960 points
303 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 in Selenium by Abha
• 27,180 points
358 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

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,110 points
965 views
0 votes
1 answer
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,130 points
1,125 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
868 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,420 points
2,456 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,420 points
1,760 views