【问题标题】:Testing Foundation modals works in Selenium but not Webkit测试 Foundation 模态在 Selenium 中有效,但在 Webkit 中无效
【发布时间】:2023-03-08 18:33:01
【问题描述】:

使用 :webkit 时,我什至无法测试我的 Foundation 模态是否存在,但使用 :selenium 一切正常。什么给了?

it "should open modal" do
  current_path.should eq(root_path)
  page.should have_selector("#modal") # This fails in webkit, works in selenium
end

我正在使用 Capybara 2.4.1 和 capybara-webkit 1.3.0。

【问题讨论】:

  • 您找到问题的答案了吗?我目前正在努力解决同样的问题
  • 我也有同样的问题...
  • 在基础导轨 (5.5.3.2) 和 capybara-webkit (1.11.1) 上也体验到这一点

标签: ruby-on-rails selenium rspec webkit capybara


【解决方案1】:

将此添加到您的测试文件中。需要调用 javascript 来打开模型,因为出现问题并阻止模态自动打开

page.execute_script(" $('#modal').foundation('reveal', 'open'); ")

【讨论】:

  • 不幸的是,这对我不起作用。弹出窗口没有打开。
猜你喜欢
  • 2018-03-07
  • 1970-01-01
  • 1970-01-01
  • 2016-03-09
  • 2018-11-26
  • 2013-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多