Skip to content

Commit 9d0689a

Browse files
committed
Added new action classes,
Added examples showing advanced interactions
1 parent 852c35c commit 9d0689a

18 files changed

+883
-32
lines changed

examples/example_drag_and_drop.e

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

examples/example_dragging_arround.e

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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

examples/example_draw_on_canvas.e

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
note
2+
description: "Summary description for {EXAMPLE_DRAW_ON_CANVAS}."
3+
author: ""
4+
date: "$Date$"
5+
revision: "$Revision$"
6+
EIS: "name=Canvas Example","src=http://www.theautomatedtester.co.uk/blog/2011/selenium-advanced-user-interactions.html", "protocol=uri"
7+
8+
class
9+
EXAMPLE_DRAW_ON_CANVAS
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+
row_selection_using_control_key
26+
end
27+
28+
feature -- Search by id
29+
30+
row_selection_using_control_key
31+
local
32+
web_driver: WEB_DRIVER
33+
wait: WEB_DRIVER_WAIT
34+
actions: SE_ACTIONS
35+
do
36+
--Create a new instance of a Web driver
37+
create web_driver.make
38+
39+
-- Start session with chrome
40+
web_driver.start_session_chrome
41+
42+
-- Go to Page under test
43+
web_driver.to_url ("http://www.theautomatedtester.co.uk/demo1.html")
44+
45+
create wait.make (web_driver,100)
46+
47+
-- Create a new instance of actions
48+
create actions.make (web_driver)
49+
50+
-- Find links
51+
if attached {WEB_ELEMENT}web_driver.find_element ((create {SE_BY}).id ("tutorial")) as l_element then
52+
53+
actions.click_and_hold (l_element).
54+
move_by_offset (-40,-60).
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+
end

examples/example_select_multiple.e

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
note
2+
description: "Summary description for {EXAMPLE_SELECT_MULTIPLE}."
3+
author: ""
4+
date: "$Date$"
5+
revision: "$Revision$"
6+
7+
class
8+
EXAMPLE_SELECT_MULTIPLE
9+
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_select_multiple
26+
end
27+
28+
feature -- Test
29+
30+
31+
test_select_multiple
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://jqueryui.com/demos/selectable/")
45+
web_driver.frame_by_index (0)
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 {LIST[WEB_ELEMENT]} web_driver.find_elements ((create {SE_BY}).css_selector("ol#selectable *")) as l_elements then
53+
54+
actions.click_and_hold (l_elements.at (1)).
55+
click_and_hold (l_elements.at (2)).
56+
click_current.
57+
execute
58+
59+
end
60+
io.read_line
61+
-- close the window
62+
web_driver.window_close
63+
end
64+
end

examples/example_slider.e

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
note
2+
description: "Summary description for {EXAMPLE_SLIDER}."
3+
author: ""
4+
date: "$Date$"
5+
revision: "$Revision$"
6+
7+
class
8+
EXAMPLE_SLIDER
9+
inherit
10+
11+
ANY
12+
redefine
13+
default_create
14+
end
15+
16+
create
17+
default_create
18+
19+
feature {NONE} -- Initialization
20+
21+
default_create
22+
do
23+
test_slider
24+
end
25+
26+
feature -- Test
27+
28+
29+
test_slider
30+
local
31+
web_driver: WEB_DRIVER
32+
wait: WEB_DRIVER_WAIT
33+
actions: SE_ACTIONS
34+
do
35+
--Create a new instance of a Web driver
36+
create web_driver.make
37+
38+
-- Start session with chrome
39+
web_driver.start_session_chrome
40+
41+
-- Go to Page under test
42+
web_driver.to_url ("http://jqueryui.com/demos/slider/")
43+
web_driver.frame_by_index (0)
44+
create wait.make (web_driver,100)
45+
46+
-- Create a new instance of actions
47+
create actions.make (web_driver)
48+
49+
-- Find links
50+
if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).class_name("ui-slider-handle")) as l_element then
51+
52+
actions.drag_and_drop_by (l_element, 120, 0).execute
53+
54+
end
55+
print("%NEnd Process")
56+
io.read_line
57+
-- close the window
58+
web_driver.window_close
59+
end
60+
end

0 commit comments

Comments
 (0)