在 Rspec 中切换到新的 window 句柄
Switch to new window handle in Rspec
我尝试了以下链接中提到的不同方法,但 none 有效。
我更喜欢我们可以使用 window 标题切换到 windows 的方法,那也行不通
- http://elementalselenium.com/tips/4-work-with-multiple-windows
- Switch to popup windows in cucumber, capybara
- How to close all the windows before the next test in a test suite?
- http://www.rubydoc.info/github/jnicklas/capybara/master/Capybara/Window
- https://github.com/teampoltergeist/poltergeist/issues/21
PS: 它不是在同一个浏览器中弹出一个新标签页。
我正在使用watir webdriver
为了定位 windows,Watir 有一个标题定位器。您可以在 watirspec:
中查看此示例(以及切换 windows 的其他方式)
it "finds window by :title" do
w = browser.window(title: "closeable window").use
expect(w).to be_kind_of(Window)
end
我尝试了以下链接中提到的不同方法,但 none 有效。
我更喜欢我们可以使用 window 标题切换到 windows 的方法,那也行不通
- http://elementalselenium.com/tips/4-work-with-multiple-windows
- Switch to popup windows in cucumber, capybara
- How to close all the windows before the next test in a test suite?
- http://www.rubydoc.info/github/jnicklas/capybara/master/Capybara/Window
- https://github.com/teampoltergeist/poltergeist/issues/21
PS: 它不是在同一个浏览器中弹出一个新标签页。
我正在使用watir webdriver
为了定位 windows,Watir 有一个标题定位器。您可以在 watirspec:
中查看此示例(以及切换 windows 的其他方式)it "finds window by :title" do
w = browser.window(title: "closeable window").use
expect(w).to be_kind_of(Window)
end