I tried this code :-

require 'selenium-webdriver'

driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://en.wikipedia.org/wiki/Cascading_Style_Sheets"

link_arr = driver.find_elements(:xpath,"//a")[0..3]
link_arr.map!{|e| e.attribute("href")}
#puts link_arr

link_arr.each do |link|
   driver.execute_script("window.open(link)")
end


But getting error as -`assert_ok': ReferenceError: link is not defined
(Selenium::WebDriver::Error::JavascriptError)

I follwoed the link :- http://www.w3schools.com/jsref/met_win_open.asp

Can anyone help me ? why is it not working ?

-- 
Posted via http://www.ruby-forum.com/.