gpt4 book ai didi

cucumber - Watir Webdriver : testing that clicking outside a modal does not close it

转载 作者:行者123 更新时间:2023-12-02 00:55:01 24 4
gpt4 key购买 nike

假设我有一个模态框。

@my_modal = @brower.div(id: 'TheModal')

假设我有一个调出模态的测试(本例中为 cucumber )

 Given I ...
When I ...
Then "My Modal" is visible
When I click outside the modal
Then "My Modal" is visible

现在定义点击模式外的步骤:

 When /^I click outside the modal$/ do
# what do I put here?
end

有什么想法吗?

我刚刚尝试了 @browser.element(xpath: '//html').click 基于 How to simulate mouse click on blank area in website by Selenium IDE? .我收到错误 Selenium::WebDriver::Error::UnknownError: unknown error: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

最佳答案

Watir 只允许您点击可见的元素。对于大多数模态实现,只有模态内部的元素才会被视为可见。

尝试:@browser.element.wd.click

如果不起作用,分享 html 可能会有所帮助。

关于cucumber - Watir Webdriver : testing that clicking outside a modal does not close it,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36433073/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com