in Selenium by
Q:
How to input text in the text box without calling the sendKeys()?

▼ Show 1 Answer

0 votes
by

// 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

Selenium
Learn More with Madanswer

Related questions

0 votes
asked Aug 19, 2019 in Selenium by rahulsharma
...