Hi Foks,
Two ways to enter text in textbox.
Input Text using WebDriver
WebDriver driver = new FirefoxDriver();
driver.get(https://www.gmail.com);
driver.findElement(By.xpath("xpath")).sendKeys("Software Testing Material Website");
input text in the text box without calling the sendKeys()
// 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'");
Cheers,
TJ
No comments:
Post a Comment