Hello,
In message "Re: Win32OLE Question"
on 06/07/09, "studlee2 / gmail.com" <studlee2 / gmail.com> writes:
> Ha! Good point, however the good folks at PhoneTrick have measures in
> place to make sure people are abused or harrassed.
>
> The main point is how do you get the focus on an object that doesn't
> have a name - in this case the nameless button? Any ideas?
Does the following example help you?
#
# The HTML file is following. The button does not have id.
# (But they have value.)
# <html>
# <body>
# <input type="button" value="button1" onclick="alert('button1')">
# <input type="button" value="button2" onclick="alert('button2')">
# </body>
# </html>
#
require 'win32ole'
ie = WIN32OLE.new('InternetExplorer.Application')
ie.visible = true
ie.navigate(URL_OF_HTML_FILE)
while ie.busy
sleep 1
end
# get button1
button1 = nil
ie.document.all.tags("input").each do |i|
if i.value == "button1"
button1 = i
break
end
end
# button1.click
if button1
button1.click()
end
Regards
Masaki Suketa