|
| 1 | +note |
| 2 | + description: "Summary description for {EXAMPLE_DRAGGING_ARROUND}." |
| 3 | + author: "" |
| 4 | + date: "$Date$" |
| 5 | + revision: "$Revision$" |
| 6 | + EIS: "name=Dragging Example","src=http://www.theautomatedtester.co.uk/blog/2011/selenium-advanced-user-interactions.html", "protocol=uri" |
| 7 | + EIS: "name=Advance Interaction","src=http://selenium.polteq.com/en/perform-a-sequence-of-actions-with-selenium-webdriver/#sthash.2uaD8CFs.dpuf", "protocol=uri" |
| 8 | +class |
| 9 | + EXAMPLE_DRAGGING_ARROUND |
| 10 | + |
| 11 | +inherit |
| 12 | + |
| 13 | + ANY |
| 14 | + redefine |
| 15 | + default_create |
| 16 | + end |
| 17 | + |
| 18 | +create |
| 19 | + default_create |
| 20 | + |
| 21 | +feature {NONE} -- Initialization |
| 22 | + |
| 23 | + default_create |
| 24 | + do |
| 25 | +-- test_dragging_around |
| 26 | + test_draggable |
| 27 | + end |
| 28 | + |
| 29 | +feature -- Search by id |
| 30 | + |
| 31 | + test_dragging_around |
| 32 | + local |
| 33 | + web_driver: WEB_DRIVER |
| 34 | + wait: WEB_DRIVER_WAIT |
| 35 | + actions: SE_ACTIONS |
| 36 | + do |
| 37 | + --Create a new instance of a Web driver |
| 38 | + create web_driver.make |
| 39 | + |
| 40 | + -- Start session with chrome |
| 41 | + web_driver.start_session_chrome |
| 42 | + |
| 43 | + -- Go to Page under test |
| 44 | + web_driver.to_url ("http://www.theautomatedtester.co.uk/demo2.html") |
| 45 | + |
| 46 | + create wait.make (web_driver,100) |
| 47 | + |
| 48 | + -- Create a new instance of actions |
| 49 | + create actions.make (web_driver) |
| 50 | + |
| 51 | + -- Find links |
| 52 | + if attached {WEB_ELEMENT}web_driver.find_element ((create {SE_BY}).class_name ("draggable")) as l_element then |
| 53 | + |
| 54 | + actions.click_and_hold (l_element). |
| 55 | + move_by_offset (30,20). |
| 56 | + move_by_offset (100, 200). |
| 57 | + release (l_element).execute |
| 58 | + end |
| 59 | + print ("%Nend process ..." ) |
| 60 | + io.read_line |
| 61 | + -- close the window |
| 62 | + web_driver.window_close |
| 63 | + end |
| 64 | + |
| 65 | + |
| 66 | + test_draggable |
| 67 | + local |
| 68 | + web_driver: WEB_DRIVER |
| 69 | + wait: WEB_DRIVER_WAIT |
| 70 | + actions: SE_ACTIONS |
| 71 | + do |
| 72 | + --Create a new instance of a Web driver |
| 73 | + create web_driver.make |
| 74 | + |
| 75 | + -- Start session with chrome |
| 76 | + web_driver.start_session_chrome |
| 77 | + |
| 78 | + -- Go to Page under test |
| 79 | + web_driver.to_url ("http://jqueryui.com/demos/draggable/") |
| 80 | + web_driver.frame_by_index (0) |
| 81 | + create wait.make (web_driver,100) |
| 82 | + |
| 83 | + -- Create a new instance of actions |
| 84 | + create actions.make (web_driver) |
| 85 | + |
| 86 | + -- Find links |
| 87 | + if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).id ("draggable")) as l_draggable then |
| 88 | + |
| 89 | + actions.drag_and_drop_by (l_draggable,120,120) |
| 90 | + .execute |
| 91 | + end |
| 92 | + print ("%Nend process ..." ) |
| 93 | + io.read_line |
| 94 | + -- close the window |
| 95 | + web_driver.window_close |
| 96 | + end |
| 97 | + |
| 98 | + |
| 99 | +end |
0 commit comments