|
This should work for you as long as ‘searchName’ is
whatever is listed in the column name Search Name from your html file you sent. The html you sent didn’t have a ‘mainFrame’ in it so I
hope you full page does otherwise you will need to remove it from the script
below. This script will loop through all rows, and walk all cells for that row—‘i’—and
try and match ‘searchName’ to each respective cell value in that
row. If it finds a match then the ‘schedule’ link is clicked
for that row an away you go. i = 1 row_count = $ie.frame("mainFrame").table(:id,
'ruleTbl').row_count while i <= row_count $ie.frame("mainFrame").table(:id,
/ruleTbl/i)[i].cells.each { |l| puts "*****\n" puts "\n#{l.to_s} = #{i}\n" puts "*****\n" if l.to_s =~ /#{searchName}/ then # this if line is not needed # if l.to_s =~ /schedule/ then puts "#######\n" print l.to_s puts
"\n#{i}iiiiiiiiiiiii\n" puts "#######\n" $ie.frame("mainFrame").table(:id,
'ruleTbl')[i][7].link(:text, /schedule/i).click break; # end End } i = i + 1 end Hope this helps, --Mark -----Original Message----- Hi, Please find attached the html which I need help with. It has table of searches which has actions like edit,view,schedule attached with them. I want to write a method which takes search name and schedules it. The logic I have used is: ------------------- $ie.frame("mainFrame").cells.each { |l| i =
i +1 puts
"*****\n" puts
"\n#{l.to_s} = #{i}\n" puts
"*****\n" if
l.to_s =~ /#{searchName}/ then
if l.to_s =~ /schedule/ then
puts "#######\n"
print l.to_s
puts "\n#{i}iiiiiiiiiiiii\n" puts
"#######\n"
$ie.frame("mainFrame").cell(:index, i).click
break;
end end } --------- Travel each cell. When I encounter search name I am looking for, I click the schedule link which is encountered next. However, one the element that I encounter, I get a element which is like concatenation of value elements in all the cells. Hence my test
condition of matching search name hits and I end up clicking wrong element. I
dont understand why this happens. When I see in the DOM tree using IE Dev
toolbar is that particular element is having is kind of null value. Is there a problem in way my html is formed, or a problem with watir. What I expected is each cell element will have text set to value what is visible in browser and it will be matter of locating that particular element. Any ideas. Please let me know if you need more info. Thanks and Regards, Manish |
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
