How to I switch to a new window for links with blank targets using Capybara

0 votes
When I am clicking on "click_link" a link with target ="_blank", it the focus on the current window.

I want to either be able to switch to the new window or to ignore the _blank attribute, I want it to navigate it to the page indicated by the link so that I can make sure that it is the right page.

I am using the web-kit and selenium drivers.

Kindly help me out with this
Jul 11, 2018 in Selenium by QueenBee
• 1,820 points
1,528 views

1 answer to this question.

0 votes

Capybara 2.3 includes the new window management API. 

You can use it as shown below:

new_window = window_opened_by {click_link 'Something'}
within_window new_window do
  # code #
end 
answered Jul 11, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

0 votes
2 answers

How to open a browser window in full screen using Selenium WebDriver with C#

Hi , we have inbuilt method Maximize(). driver.Manage().Wind ...READ MORE

answered Sep 5, 2020 in Selenium by Sri
• 3,010 points
11,185 views
+1 vote
1 answer
0 votes
1 answer

How to apply wait for new window using Selenium WebDriver?

As sometimes during web automation, when you ...READ MORE

answered Jul 9, 2019 in Selenium by Vaishali Walia
3,873 views
0 votes
2 answers

How to open a new tab in existing browser window using Javascript Executor?

Hi Meenal, you can use executeScript() method ...READ MORE

answered Jul 22, 2019 in Selenium by Abha
• 28,000 points
4,830 views
0 votes
2 answers
+1 vote
1 answer

How to handle a combobox which when clicked open in new window with list of items(to be clicked) in selenium java ?

@Pavithra, you can try using following commands ...READ MORE

answered Oct 29, 2019 in Selenium by Abha
• 28,000 points
380 views
0 votes
1 answer

I tried to open a new website when a new tab is opened using Selenium Webdriver

Try this code: ArrayList<String> tabs = new ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,520 points
2,327 views
0 votes
1 answer
0 votes
1 answer

Is it possible for a website to detect that we are using Selenium with ChromeDriver

Selenium tests for pre-defined javascript variables which ...READ MORE

answered Apr 27, 2018 in Selenium by Meci Matt
• 9,460 points
4,683 views