I am attempting to automate the login process using chimpjs with cucumber and selenium, but I am encountering an issue due to the modal used for login. Every time I try to click on the login button within the modal, I receive the following error message:
Error: unknown error: Element is not clickable at point (764, 42). Other element would receive the click: <div class="login-overlay " style="display: block; opacity: 0.969096;">...</div>
Despite taking the necessary steps in selenium to wait for the modal to appear before entering the username and password, clicking on the login button fails consistently.
module.exports = function() {
this.Given(/^I am on the website homepage$/, function () {
client.url('example.com');
});
this.When(/^I click the login button$/, function () {
client.click('.navbar__link--login');
});
this.Then(/^I see the login screen$/, function () {
client.waitForExist('.login-overlay');
});
this.Then(/^I enter my username in the email field$/, function () {
client.setValue('#username', '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5835213d35393134183d35393134763b3735">[email protected]</a>');
});
this.Then(/^I enter my password in the password field$/, function () {
client.setValue('#password', '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b26322e262a22270b2e262a222765282426">[email protected]</a>');
});
this.Then(/^And I click the login button$/, function () {
client.click('.login-btn');
});
};
All steps pass successfully except for the final one. Could this be due to the use of a modal for login? Is there a specific way to click buttons within modals using selenium? Am I overlooking something obvious?
Solution: After struggling to click on the element directly, I discovered that I could perform a form submission using the client.submitForm(selector)
method. This workaround resolved the issue, allowing me to pass the final step. Additionally, I updated the final step text to 'And I submit the login form' for clarity. More information on the form submit option can be found here: