我正在使用水豚、硒、webkit 和黄瓜。如何在无头浏览器中关闭弹出窗口?它总是默认接受“ok”。我的测试用例非常适合 selenium(我使用此代码page.driver.browser.switch_to.alert.dismiss
),但对于无头浏览器失败。
这是我的测试用例
Feature: Deleting keywords
In order to use the app
I need to be able to delete keywords
Background:
Given the database contains no test data
Given there are accounts and users
And I am on the homepage
And I am signed in as "user"
Scenario: Successfully deliting keyword
When I create the following keywords:
| keyword | descrip | title |
| kitty | hello | Fluffy |
Then I should see "Keyword created."
When I follow "Keywords"
Then I should see "kitty"
When I attempt to delete the keyword "kitty"
And I dismiss popup
Then there should be 1 keyword
Then I should see "kitty"
感谢帮助