0

我正在尝试使用 Watir Webdriver 在 Firefox 中打开一个新选项卡(javascript 已打开):

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')")

我按照此页面上的方法:以编程方式在选项卡上打开新页面 但它会打开一个新窗口,而不是打开一个新选项卡。我该怎么做才能只打开一个新标签而不是一个新窗口?或者任何其他方法来打开一个新标签?

4

1 回答 1

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.

于 2012-08-14T13:11:07.417 回答