0

I am trying to open a new tab in firefox with Watir Webdriver (javascript is on):

require 'rubygems'
require 'watir-webdriver'
browser = Watir::Browser.new :ff, :profile => "default" 
browser.goto "http://google.com"
browser.execute_script("window.open('http://yahoo.com','_newtab')")

I followed the method on this page: Programmatically open new pages on Tabs But it opens a new window, instead of opening a new tab. What can I do to open only a new tab and not a new window? Or any other method to open a new tab?

Community
  • 1
  • 1
Konstantin
  • 2,983
  • 3
  • 33
  • 55
  • I managed to investigate that some of the profile options of Firefox need to be modified, like something similar: `profile['browser.link.open_newwindow']=?` and/or `profile['browser.link.open_newwindow.restriction']=?` they are described here: [link](http://kb.mozillazine.org/Browser.link.open_newwindow) – Konstantin Aug 14 '12 at 00:24
  • Why do you care if the new page is opened in a tab or in a window? – Željko Filipin Aug 16 '12 at 09:33

1 Answers1

2

I had the same issue, and I've struggled for a day until I found it's a known Selenium issue: http://code.google.com/p/selenium/issues/detail?id=3380

Apparently, Selenium doesn't support opening links in a new tab, only a new window.

GilZ
  • 6,418
  • 5
  • 30
  • 40