Hi Mathew,

I am using watir gem 1.5.1.1145 and the script works fine. I don't know much
about this error.

Regards,
Angrez

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

 Hi,



     I installed latest gem and run the script. But I am getting following
error in Run-time.





*** WARNING *** Windows users should check the "Run process in terminal"
check box in the Debugger Preferences

to see STDOUT and STDERR output in real time.



c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1158/./watir.rb:1830:in
`method_missing': document (WIN32OLERuntimeError)

    OLE error code:80070005 in <Unknown>

      Access is denied.



    HRESULT error code:0x80020009

      Exception occurred. from c:/ruby/lib/ruby/gems/1.8/gems/watir-
1.5.1.1158/./watir.rb:1830:in `wait'

            from 
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1158/./watir.rb:1829:in
`wait'

            from 
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1158/./watir.rb:2577:in
`click'

            from 
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1158/./MongoFnDef.rb:39:in
`login'

            from C:/watir/MongoMain.rb:23





Thanks in advance,



Mathew





* *


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

*From:* Angrez Singh [mailto:[EMAIL PROTECTED]
*Sent:* Friday, March 23, 2007 4:57 PM
*To:* Mathew Jacob; wtr-general@rubyforge.org
*Subject:* Re: [Wtr-general] Unable to select the button from button-menu



Hi,

Sorry forgot to mention the watir version. You should use watir 1.5.x(latest 
version for this to work). XPath functionality is added after watir
1.4.1 is released. So its not there in 1.4.1. Uninstally the current
version and install latest gem.

Regards,
Angrez

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

Hi Angrez,



               I have run that script and getting the error.



Error :



./MongoFnDef.rb:119:in `markasRead': undefined method `element_by_xpath'
for #<Watir::IE:0x2d1af68> (NoMethodError)

            from C:/Program Files/Watir/examples/MongoMain.rb:43



*Environment*



         Ruby-184-20 , Watir-1.4.1



*Set-up in the file*

require 'watir'

include Watir



Regards,



Mathew





* *


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

*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
*On Behalf Of *Angrez Singh
*Sent:* Friday, March 23, 2007 11:06 AM
*To:* wtr-general@rubyforge.org
*Subject:* Re: [Wtr-general] Unable to select the button from button-menu



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
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general





_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to