rubysafariwatirbrowser-automationsafariwatir

How can I continuously open websites using Watir?


I have an array of url strings (i.e. "http://www.cnn.com") which I want to iterate through and open in Safari using watir.

urlArray.each do |url|
browser.goto(url)
end

will open the first page, but it never proceeds to the next pages in the array.

Any ideas on what's going on?


Solution

  • This worked for me, it opened both Google and Yahoo.

    require "rubygems"
    require "safariwatir"
    
    urlArray = ["http://google.com", "http://yahoo.com"]
    browser = Watir::Safari.new
    urlArray.each do |url|
      browser.goto url
    end
    

    When I added "http://www.cnn.com" to urlArray

    urlArray = ["http://www.cnn.com", "http://google.com", "http://yahoo.com"]
    

    it opened just cnn.com, so the problem is at that page.