【发布时间】:2016-04-07 23:10:43
【问题描述】:
我正在尝试将 chimpjs 与黄瓜和硒一起使用来自动登录,但我们目前通过模式登录。目前所有尝试单击该模式上的登录按钮都会导致相同的错误:
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>
这些是我为硒采取的步骤。在输入用户名或密码之前,我正在等待模式出现,但是当我尝试单击登录按钮时,它失败了。
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', 'myemail@email.com');
});
this.Then(/^I enter my password in the password field$/, function () {
client.setValue('#password', 'myemail@email.com');
});
this.Then(/^And I click the login button$/, function () {
client.click('.login-btn');
});
};
目前除了最后一步,一切都通过了。是因为我们使用的是模式登录吗?或者有没有办法点击硒模态上的按钮?还是我错过了一个非常明显的步骤?
解决方案:我找到了解决方案,我无法点击该元素,但是我能够通过client.submitForm(selector) 选项提交表单。这样做似乎可以解决问题,并且我能够通过最后一步。为了便于阅读,我还将最后一步更改为“我提交登录表单”。您可以在此处查看有关表单提交选项的更多信息:http://webdriver.io/api/action/submitForm.html
【问题讨论】:
标签: javascript selenium cucumberjs chimp.js