在我的hooks.rb中我有
Before do
@browser = Watir::Browser.new :chrome, :switches => %w[--ignore-certificate-errors --test-type --disable-web-security --disable-extensions]
end
在我的account_home.rb页面中,我有:
class AccountHome
include PageObject
button(:billtransfers, :id => 'nav_transfersPayments')
end
我试图等到div消失后再单击一个元素:
When(/^the user navigates to Bills & Transfers \/ Vendors$/) do
@browser.div(:id => 'spinner').wait_while_present
on(AccountHome).billtransfers_element.when_present.billtransfers
on(AccountHome).vendors
sleep 5
end
但我一直收到以下错误:
Element is not clickable at point (95, 254). Other element would receive the click: <div id="spinner" class="screenMask">...</div>
似乎没有等到id为'spinner'的div消失。另外,如果我用sleep而不是wait_while_present替换它,它会等待,但是这一行:
on(AccountHome).billtransfers_element.when_present.billtransfers
我收到一条错误消息,指出billtransfers不是一种方法。我提到了这个文档https://github.com/cheezy/page-object/wiki/Ajax-Calls
总的来说,我只想等到div消失然后点击按钮。但是1.它不是在等待,而是在出现时不点击按钮。