jeudi 28 septembre 2017

javascriptexecutor not working with angularjs forms

I am trying to automate a login form by selenium webdriver (javascriptexucutor) which is built in angularjs. The script is entering data in email textbox; but when submit button is clicked error message shows that textbox is not filled. I have also used events like onkeyup, blur; but error shows these functions are not accepted. Textbox validaton works fine with sendkeys() and it takes time; but facing issue when javascriptexecutor is used. html code:

<input type="text" ng-keypress="logindata($event)" ng-model="email" placeholder="Email ID" value="" name="email" class="form-control ng-pristine ng-valid ng-touched" id="email">`

selenium-java code:

JavascriptExecutor executor = (JavascriptExecutor) driver; 
WebElement emailElement = driver.findElement(By.id("email"));
executor.executeScript("arguments[0].value='tester'", emailElement);

Aucun commentaire:

Enregistrer un commentaire