firefox - working with tabs in selenium webdriver in Ruby -


i'm testing firewall, want open set of pages simultaneously each in new tab, save tab id in threads , when threads finished, analyze tabs 1 one. here sample code:

require 'selenium-webdriver' require 'thread' mutex = mutex.new profile = selenium::webdriver::firefox::profile.new profile["webdriver.load.strategy"] = "unstable"; browser = selenium::webdriver.for :firefox,:profile => profile max = 100; th = [] max.times{ |i|    th[i] = thread.new {       mutex.synchronize         # todo browser.open_new_tab          # todo thread.current["tab_id"] =  browser.get_tab_id         thread.current["i"] =          browser.get("http://foo.bar?id=#{i}")       end    }    sleep 2 }  th.each{|t|    t.join    tab = t["tab_id"]    # todo browser.open_tab(tab)    analyse_content # method } 

what should use in todo lines?

attention: since i'm using multi threading, dont want use alt + tab


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -