Hi, folks,
As we known, both these methods below could bring us the objects for current
IE page. But till now, I have no seen the
show_checkboxes, show_selectlists, show_textfields methods and so on.
So, I have to consult with your to generate the objects by filtering the
specified type just mentioned, and how to modify the following methods to
gernerate them for the input tag ones?
Any suggestion is appreciated
Thanks.w
-Wiston.
def show_all_objects
puts "-----------Objects in page -------------"
doc = document
s = ""
props = ["name", "id", "value", "alt", "src"]
doc.all.each do |n|
begin
s += n.invoke("type").to_s.ljust(16)
rescue
next
end
props.each do |prop|
begin
p = n.invoke(prop)
s += " " + "#{prop}=#{p}".to_s.ljust(18)
rescue
# this object probably doesnt have this property
end
end
s += "\n"
end
puts s
end
def show_links
props = ["name", "id", "href"]
print_sizes = [12, 12, 60]
doc = document
index = 0
text_size = 60
# draw the table header
s = "index".ljust(6)
props.each_with_index do |p, i|
s += p.ljust(print_sizes[i])
end
s += "text/src".ljust(text_size)
s += "\n"
# now get the details of the links
doc.links.each do |n|
index += 1
s = s + index.to_s.ljust(6)
props.each_with_index do |prop, i|
printsize = print_sizes[i]
begin
p = n.invoke(prop)
temp_var = "#{p}".to_s.ljust(printsize)
rescue
# this object probably doesnt have this property
temp_var = "".to_s.ljust(printsize)
end
s += temp_var
end
s += n.innerText
if n.getElementsByTagName("IMG").length > 0
s += " / " + n.getElementsByTagName("IMG")[0.to_s].src
end
s += "\n"
end
puts s
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---