【发布时间】:2016-06-26 03:59:48
【问题描述】:
一段时间以来,我一直在我的 Rails 应用程序上使用 Selenium-Webdriver 作为 javascript 驱动程序运行 Cucumber 测试,并获得了稳定的结果。我尝试切换到 Poltergeist 以无头运行。
我的一些测试运行了一个测试 Stripe 事务,它触发了一个 javascript 弹出窗口。我有如下步骤:
When(/^I wait to see "([^"]*)" in a Stripe popup$/) do |arg1|
within_frame 'stripe_checkout_app' do
wait_until do
expect(page).to have_content(arg1)
end
end
end
当我使用 selenium 作为我的 Capybara javascript 驱动程序时,这些步骤运行得非常好,但是当我使用 :poltergeist 作为 javascript 驱动程序时它们会失败。我收到如下错误:
Unsafe JavaScript attempt to access frame with URL http://127.0.0.1:64780/charges/1/edit from frame with URL https://checkout.stripe.com/v3/VguVZoYKogJUsO05PpIlfA.html?distinct_id=ad0ab5bb-c346-dac7-62dc-2a4a8e4dcf64. Domains, protocols and ports must match.
有谁知道为什么poltergeist会出现这种错误,而selenium-webdriver不会出现这种错误?
【问题讨论】:
-
你用的是什么版本的FF和selenium-webdriver,你现在用的是什么版本的phantomjs?
标签: javascript ruby-on-rails selenium poltergeist