Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
289 views
by The go-to Tester (391 points)
How may I use Javascript Executor to enter data to a textbox field?

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

You can do that by changing value attribute of TextBox filed 

webdriver.executeScript("document.getElementById('elementID').setAttribute('value', 'your text here')");
 
But ideal option will be to use elem.sendKeys("your text here"); Where elem is identification of your text.
 

Hope it helps.

 


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...