Hi-

 

The link that was posted was fairly useful. However, I can’t seem to work out how to interact with a particular element:

 

irb(main):001:0> require 'watir'

 

irb(main):003:0> ie = Watir::IE.start("http://mytestaddress.com")

 

irb(main):004:0> class Watir::IE

irb(main):005:1> def run_script(js)

irb(main):006:2> ie.Document.parentWindow.execScript(js)

irb(main):007:2> end

irb(main):008:1> end

 

irb(main):009:0> ie.divs.show

index id                  className

 

irb(main):010:0> ie.frame("main").divs.show

index id                  className

1     background          merge_background

2     search

3     search_patients_wrappermerge_box

4     search_wrapper      merge_search_results_wrapper

5     wait_msg

6     search_results      merge_search_results

7     10439,10459         People_Widget

8     10439,10439         People_Widget

9     merge_next_10       merge_next_10

10    pat1                merge_box

11    drop_p1             drop_zone

12    drop_p1_toolbar     tool_bar

13    person_one          person_one

14    p1_body             merge_body

15    pat2                merge_box

16    drop_p2             drop_zone

17    drop_p2_toolbar     tool_bar

18    person_two          person_two

19    p2_body             merge_body

20    button_panel        merge_btn_panel

21    reports             dm_reports

22    invisible

 

irb(main):011:0> widget = ie.frame("main").div(:id, "10439,10439")

irb(main):012:0> widget.flash

 

 

If I wanted to use code similar to the example

    #add some items to the cart

    [1,1,2,1,2].each do |id|

      product = "product_#{id}"

      ie.run_script("document.blah = document.createEventObject(); document.blah.button = 1")

      ie.run_script("document.getElementById('#{product}').fireEvent('onmousedown', document.blah)")

      ie.run_script("document.blah = document.createEventObject(); document.blah.clientX = document.getElementById('cart').offsetLeft; document.blah.clientY = document.getElementById('cart').offsetTop")

      ie.run_script("document.getElementById('#{product}').fireEvent('onmousemove', document.blah)")

      ie.run_script("document.getElementById('#{product}').fireEvent('onmouseup', document.blah)")

      sleep(1)

    end

 

(barring the loop,)

 

How would I access the People_widget for dragging?

 

Thanks

 

Max

 

Max Russell

test Analyst.

InPS

 

Visit our Web site at www.inps.co.uk

 

The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of In Practice Systems Limited or any of its affiliates. If you are not the intended recipient please contact [EMAIL PROTECTED]

 

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

Reply via email to