Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium: delete contents from a textbox

Through selenium. how to delete contents from textbox.

I have to delete the last 2 characters from text box using selenium command.

Ex.ABCD to AB.

like image 652
smriti Avatar asked Jun 23 '11 01:06

smriti


People also ask

How do you clear the content of a text box in Selenium?

We shall use the clear method to remove the content from a text area or an edit box. First, we shall identify the text area with the help of any locator. A text area is identified with a textarea tagname in the html code. Let us input some text inside the below text area, then clear the text.

What method is used to clear the data from an element in an application in Selenium?

clear() element method – Selenium Python clear method is used to clear text of any field, such as input field of a form or even to anchor tag paragraph, etc. It replaces its contents on the webpage in your browser.

How do you select all and delete in Selenium?

Syntax. To delete all the keys entered simultaneously, we have to pass CTRL+A and BACKSPACE as parameters to the send_keys method.

What is the use of getText method in Selenium?

What Is getText() Method? The Selenium WebDriver interface has predefined the getText() method, which helps retrieve the text for a specific web element. This method gets the visible, inner text (which is not hidden by CSS) of the web-element.


1 Answers

Try this -

selenium.type("text_box_object", "ABCD");
selenium.typeKeys("text_box_object", "\b");
selenium.typeKeys("text_box_object", "\b");
like image 171
rs79 Avatar answered Oct 20 '22 01:10

rs79