Hi Mathew,

Just looked at the Yahoo mail app (not the beta one) and had a look at the
HTML. The options that you are trying to select like "Mark as Read", "Mark
as Unread" are in <li> tags. So you need to access them using xpath and then
fire click event. Following code works for me for marking first message in
inbox are read.
require 'watir'

include Watir

ie = IE.new
ie.goto("http://mail.yahoo.com";)
ie.maximize()
ie.text_field(:name, "login").set(username)
ie.text_field(:name, "passwd").set(password)
ie.button(:value, "Sign In").click()
ie.button(:id, "checkmailbutton").click()
# select first message.
ie.radio(:id, "folderviewmsg0checkbox").set()
# click on mark button so as options can be displayed
ie.button(:value, "Mark").click()
# select <li> element that has text "Mark as Read"
element = ie.element_by_xpath("//li[contains(.,'Mark as Read')]")
# Print properties of the element just to make sure you selected correct
element.
puts element.value
puts element.tagName
puts element.innerHTML
# fire click event.
element.click()

Let me know if this works.

Regards,
Angrez


On 3/22/07, Mathew Jacob <[EMAIL PROTECTED]> wrote:

 Hi,



    I am unable to select the button from the button-menu. Following is
the scenario. Please help me to resolve this issue.





*Scenario:*

In Yahoo Mail, Inbox folder(Click on Inbox), there exists a buttonmenu
dropdown "Mark". It has two options "Mark as Read" and "Mark as Unread".

*Problem#*

* *Unable to click the options "Mark as Read" or Mark as Unread"

*Tried and Failed:*

ie.select_list(:name,"top_read_unread").select("Mark as Read")

*Error*:

irb(main):007:0> ie.button(:name,"top_bpress_topmark").click

=> ""

irb(main):008:0> ie.select_list(:name,"top_read_unread").select("Mark as
Unread")

Watir::Exception::UnknownObjectException: Unable to locate object, using
name and top_read_unread

        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1928:in
`assert_exists'

        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2940:in
`select_item_in_select_list'

        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2925:in `select'

        from (irb):8

        from ♥:0

irb(main):009:0> ie.select_list(:name,"top_read_unread").exists?

=> false

irb(main):010:0> ie.div(:id,"markmenu").exists?

=> true

irb(main):011:0>



*The Html code*:

<div id="contentbuttonbartop" class="contentbuttonbar">

    <span class="first">        <input type="submit" class="inputbutton"
name="top_bpress_delete"

        value ="Delete"

        title="Delete selected Message(s)">        <input type="submit"
class="inputbutton" name="top_bpress_spam"

        value="Spam"

        title="Mark selected Message(s) as Spam">        <select
name="top_read_unread" class="dropdown">

        <option value="0">Mark as Unread</option>

        <option value="1">Mark as Read</option>

        </select>

        <input type="submit" class="inputbutton" name="top_bpress_topmark"

        value = "Mark"

        title="Mark selected Message(s)">        <select
name="top_move_select" style="width:125px" class="dropdown">

        <option value="" selected>Move...</option>                <option
value="Inbo%20x"  title="Inbo x">Inbo x</option>                <option
value="%ef%bb%bfPersonal"  title="Personal">Personal</option>
<option value="Sen%20t"  title="Sen t">Sen t</option>                <option
value="Work%2dMails"  title="Work-

Regards,

Mathew




*Ya**ho**o India, EGL, Bangalore – 71, Phone:+91-80-30516346,
Mobile:+91-9945849925*



_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to