キュウリとセレンを使ってログインを自動化しようとしていますが、現在はモーダルでログインしています。現在、そのモーダルでログインボタンをクリックしようとすると、同じエラーが発生します。セレンを含むモーダルのボタンをクリックすることはできますか?
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', '[email protected]');
});
this.Then(/^I enter my password in the password field$/, function() {
client.setValue('#password', '[email protected]');
});
this.Then(/^And I click the login button$/, function() {
client.click('.login-btn');
});
};
現在、すべてが最後のステップを除いて渡します。それはログイン用のモーダルを使用しているからでしょうか?または、セレンのモーダルのボタンをクリックする方法はありますか?または、私は本当に明白なステップを欠いていますか?
解決方法:解決策が見つかりましたが、要素をクリックできませんでしたが、client.submitForm(selector)
オプションを使用してフォームを送信できました。これを実行すると問題が解決したように見え、最終ステップを通過することができました。私はまた、最後のステップを「読みやすいようにログインフォームを提出してください」と変更しました。ここにフォーム送信オプションの詳細が表示されます:http://webdriver.io/api/action/submitForm.html