Where am I going wrong here?

 

require 'test/unit'

require 'watir'

require 'observer'

 

class Watir::IE

  def run_script(js)

    ie.Document.parentWindow.execScript(js)

  end

end

 

class Dragdiv

            include Observable

            def run

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

                        ie.frame("main").run_script("document.getElementById('10439,10439').fireEvent('onmousedown', document.blah)")

                        ie.frame("main").run_script("document.blah = document.createEventObject(); document.blah.clientX = document.getElementById('search_results'); document.blah.clientY = document.getElementById('search_results')")#.offsetLeft .offsetTop

                        ie.frame("main").run_script("document.getElementById('10439,10439').fireEvent('onmousemove', document.blah)")

                        ie.frame("main").run_script("document.getElementById('10439,10439').fireEvent('onmouseup', document.blah)")

                        changed

                        notify_observers(TestWatir)

            end

end

 

class TestWatir < Test::Unit::TestCase

 

            #def initialize(dragdiv)

    #                  dragdiv.add_observer(self)

            #end

           

            def test_drag_and_drop

                        ie = Watir::IE.start('http://)

                        #ie.maximize

                        ie.frame("main").text_field(:name, "username").set("")

                        ie.frame("main").text_field(:name, "password").set("")

                        ie.frame("main").select_list(:name, "ldapDir").select("")

                        ie.frame("main").button(:name, "Login").click

                       

                        #expand the admin node

                        ie.frame("left").link(:index, 35).click

                        #click on the data management link

                        ie.frame("left").link(:index, 54).click

                       

                        #Enter a search string into the search field.

                        ie.frame("main").text_field(:id, "Search_box").set("B")

                        #Click to search

                        ie.frame("main").button(:id, "btn_search").click

                       

                        dragdiv = Dragdiv.new

                        dragdiv.add_observer(self)

                        dragdiv.run

                        update

            end

end

 

 

I have been trying to set up an observer so that I can wait for the drag drop action to occur….

 

(Actually, maybe this should really be for the main ruby mailing list…)

 

Max Russell

test Analyst.

InPS

 

Tel: 01382 223900

Fax: 01382 204488

 

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