As a beginner in web automation testing, I am encountering an issue with locating the login button on a login screen page.
While finding the name and password textfields was easy using by.model, I am struggling to locate the login button with my script.
I have tried element(by.css(.className)) as suggested online but it keeps throwing
NoSuchElementError: No element found using locator: By.cssSelector(".btn btn-lg btn-primary btn-block")
.
Can someone help me figure out what I am doing wrong?
Thank you,
LoginBtn HTML:
<button class="btn btn-lg btn-primary btn-block" type="submit" ng-disabled="loading">login</button>
My code:
describe('Test login', function() {
var username = element(by.model('formData.email'));
var password = element(by.model('formData.password'));
var loginBtn = element(by.css('.btn btn-lg btn-primary btn-block'));
beforeEach(function() {
browser.get('some site'); //hidden on purpose
});
it('should have a title', function() {
username.sendKeys(1);
password.sendKeys(2);
loginBtn.click();
});
});