Aug 22, 2019 in Selenium
Q: How to input text in the text box without calling the sendKeys()?

1 Answer

0 votes
Aug 22, 2019

// To initialize js object

JavascriptExecutor JS = (JavascriptExecutor)webdriver;

// To enter username

JS.executeScript("document.getElementById('User').value='SoftwareTestingMaterial.com'");

// To enter password

JS.executeScript("document.getElementById('Pass').value='tester'");

1

2

3

4

5

6

// To initialize js object

JavascriptExecutor JS = (JavascriptExecutor)webdriver;

// To enter username

JS.executeScript("document.getElementById('User').value='SoftwareTestingMaterial.com'");

// To enter password

JS.executeScript("document.getElementById('Pass').value='tester'");

Learn JavaScriptExecutor in Selenium with Examples

Click here to read more about Selenium
Click here to read more about Insurance

Related questions

0 votes
Aug 19, 2019 in Selenium
...