Monday, 4 July 2016

How to clear data from a text box using JavaScriptExecutor in Selenium

Sometimes, clear method does not work. It does not clear the data from text box. In those situations, we can use Java Script to clear the data.
Below line clears the data from edit box.

((JavascriptExecutor) driver).executeScript("arguments[0].value ='';", element);

Note that second parameter is the name of Web Element (Text box).

What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com

No comments:

Post a Comment

Buy Best Selenium Books

Contributors