hi all--
i've been trying to write a function which dynamically finds all the
html elements on the page and then fills the form based on the found
html elements.
So, in compete psuedo-code, i'd like to do something like
every field in pageObject do
if field is textfield then
get the name
generate a value
fill the field
elsif field is button then
/ if submit then submit
end
end.
I've tried to write a function for this in ruby but the parsing in the
function doesn't work well (although i've yet to decipher why it doesn't
work well). that function looks like this:
# Parse the web page, extracting links to images
def parse(host)
dict = { }
@body= host.getHTML()
if [EMAIL PROTECTED]
return
end
theTags = ['select','input']
for x in theTags do
tokenizer = HTMLTokenizer.new(@body)
while tag = tokenizer.getTag(x)
name = tag.attr_hash['name']
type = tag.attr_hash['type']
if name != nil then
dict[type]=name
end
end
end
return dict
end
If am able to make this function I will be less tied to the particulars
of the gui, name, etc. Can anyone help me figure out what's wrong with
the above function or having already approached this problem, suggest to
me another angle.
Thanks-
Beth
>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general