Currently, I am in the process of configuring Protractor to test my application. However, I am encountering a roadblock as it requires authentication through Gmail and I am struggling with the login process:
describe('Vivace Home page', function() {
var hasClass = function (element, cls) {
return element.getAttribute('class').then(function (classes) {
return classes.split(' ').indexOf(cls) !== -1;
});
};
beforeEach(function() {
browser.ignoreSynchronization = true;
browser.get('/');
var emailInput = browser.driver.findElement(by.id('Email'));
emailInput.sendKeys('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dbabbaaeb79c9bbcb6bab2b7f5b8b4b6">[email protected]</a>')
var nextButton = browser.driver.findElement(by.id('next'));
nextButton.click().then(function() {
browser.pause();
var passwordInput = browser.driver.findElement(by.id('Passwd'));
console.log(passwordInput);
passwordInput.sendKeys('11111');
// var signInButton = browser.driver.findElement(by.id('signIn'));
})
});
it('should have the correct title', function() {
expect(browser.getTitle()).toEqual('InRhythm - Vivace');
});
});
During the execution, Protractor successfully opens the Gmail page, enters the email address, clicks the next button. When I pause the browser, I can visually confirm that the password input field with the ID "Passwd" is present on the page as seen in the inspector tool. However, I'm unable to access it to complete the login process.
When I eliminate the browser.pause, I encounter the following error:
Failed: no such element: Unable to locate element: {"method":"id","selector":"Passwd"}