Hello,
I'm playing around with WATIR and here is my problem:
#test::unit includes
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
require 'watir'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
require 'watir'
ie = Watir::IE.new
ie = Watir::IE.start("http://mail.yahoo.com")
test = ie.contains_text("You have")
if !test
ie.text_field(:name, "login").set("jirmac2003")
ie.text_field(:name, "passwd").set("*********")
ie.button(:value, "Sign In").click
end
a = ie.contains_text("You have")
if !a
puts "Test failed!"
else
puts "Test passed."
end
ie = Watir::IE.start("http://mail.yahoo.com")
test = ie.contains_text("You have")
if !test
ie.text_field(:name, "login").set("jirmac2003")
ie.text_field(:name, "passwd").set("*********")
ie.button(:value, "Sign In").click
end
a = ie.contains_text("You have")
if !a
puts "Test failed!"
else
puts "Test passed."
end
This program tries to log into my yahoo mail account, which works fine. But what can I do to read the number of my new emails? The relevant part of the html looks as follows:
<tr><td
valign="top">
<h2 style="margin-bottom:8px;">
Welcome, Jiri!
</h2>
<img src=""http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/bsc/mail16_1.gif">http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/bsc/mail16_1.gif" width=16 height=16>
You have <b>0 unread messages</b>:<br>
</td>
</tr>
<h2 style="margin-bottom:8px;">
Welcome, Jiri!
</h2>
<img src=""http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/bsc/mail16_1.gif">http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/bsc/mail16_1.gif" width=16 height=16>
You have <b>0 unread messages</b>:<br>
</td>
</tr>
Is there any command in WATIR that would allow me to read this info directly? Or do I need to use other libraries (e.g. DOM) to parse the content? If the latter, would it be possible to get an example how WATIR and DOM (or anything similar) are integrated?
Thanks, Jirka
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
