Used below codes to automate a login form. Form is built in AngularJS and I am using Protractor Framework. After filling textbox and clicked submit button; I am getting error that both textbox are empty. Used wait also. sendkeys is working fine, but its taking time to input larger forms; so I am expecting to use executeScript.
HTML Code:
<input id="email" class="form-control ng-pristine ng-valid ng-touched" type="text" ng-keypress="logindata($event)" ng-model="email" placeholder="Email ID" value="" name="email">
<input id="pass" class="form-control ng-pristine ng-valid ng-touched" type="password" ng-keypress="logindata($event)" ng-model="pass" placeholder="Password" name="pass">
Protractor Code:
var username = element(by.model('email'));
browser.executeScript("arguments[0].value='test@gmail.com'", username);
var password = element(by.model('pass'));
browser.executeScript("arguments[0].value='test123@'", password);
var submitButton = element(by.css('button.btn.btn-block'));
submitButton.click();
Aucun commentaire:
Enregistrer un commentaire