Opening a new tab in Capybara / Poltergeist
Right, as of Feb 5th 2014 and v1.6 of poltergeist, you can do this, as ...
@session.click_on "link_with_target _blank"
@session.switch_to_window(@session.windows.last)
#Do whatever you're doing
@session.current_window.close
@session.switch_to_window(@session.windows.first)
Hope that clears things up for somebody...
I did this with
page.switch_to_window(page.windows[0])
Maybe that's useful to someone.