I am trying to open a link by clicking on it using capybara / poltergeist, which opens in a new tab.
I can not make it work.
@session.find(<link>).click
just seems to remain on the same page as
click_link "<link>" @session.driver.window_handles
It seems to me that I have 1 window, no matter what I do.
How do I get this link to open in a new tab?
There seems to be quite a bit of confusion as to what works or doesn't work ( With Capybara, how do I go to a new window for links with "_blank"? Goals? ).
Hoping that someone handled this ... It seems I canβt think about it.
Ok When upgrading to the latest poltergeist (1.6.0), we have some progress.
Now, however, I have two windows, but I donβt know how to switch between them.
@session.windows
gives me
[Window @handle = "0", Window @handle = "1"] (slightly modified as it was a bit funny).
But
@session.switch_to_window(1)
leads to
NoMethodError: undefined method `handle' for "1":String
source share