Replace character using Ruby/Watir

April 25, 2009

Read in data from a file and replace the text using /replacetext./

urlfile= “C:\\printservers\\printurls.txt”
i=1
servermax = 4

File.open(urlfile, ‘r’) do |f1|
while line = f1.gets
result = {}
server,product1,durl,product2,lurl,product3,curl,product4,murl,product5,surl,product6,mpurl=

line.split(”,”)

while i <= servermax
server1 = server.gsub!(/print01-0./, “print01-0″+ “#{i}”)
f.puts “1. First verify server is up #{server1}”

$ie.goto(server1)
i= i+1
end

end

end

Previous post: How to verify image properties using Ruby/Watir

Next post: Test Management tools compatible to MS Visual Studio Team System …