Hey Guys,
I read the solution here:
http://groups.google.com/group/watir-general/browse_thread/thread/86488f3bcf641f4/c0dbd194a23cca8b?lnk=gst&q=multithreading#c0dbd194a23cca8b
and for some odd reason it is not working at all.
Here is my situation. The user has a portal that they can enter data.
Once this data is entered, our back end system generates a unique ID
for the PDF Image associated with this data. The issue at hand is that
sometimes this unique ID is generated for two separate sets of data.
Here is what I have so far...
{code}
require 'rubygems'
require 'watir'
require 'yaml'
require 'thread'
include Watir
def create_data
$HIDE_IE=false
browser = Watir::Browser.new
browser.speed = :zippy
config = YAML::parse(File.open(File.dirname(__FILE__) + '/../../
config.yml')).transform
user = config['employee']['user']
pass = config['employee']['pass']
site = config['employee']['site']
browser.goto site
browser.text_field(:name, 'txtuser').set(user)
browser.text_field(:name, 'txtpwd').set(pass)
browser.button(:name, 'btnlogin').click
browser.text_field(:name, 'txttitle').set("JUNK")
browser.text_field(:name, 'txtcomment').set("JUNK")
browser.button(:name, 'btnsubmit').click
browser.button(:name, 'btnhistory').click
linkloc = browser.link(:text, /New Data/).link_string_creator
pdffile = linkloc[0].split('/').last
puts 'new Data PDF is: ' + pdffile
browser.close
end
threads = []
2.times do
threads << Thread.new {create_data}
end
threads.each {|x| x.join}
{/code}
When I run this, only one instance of IE comes up. What am I doing
wrong?
Any help would be greatly appreciated... :)