druid-s 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/.travis.yml +27 -0
- data/ChangeLog +541 -0
- data/Gemfile +8 -0
- data/README.md +78 -0
- data/Rakefile +33 -0
- data/cucumber.yml +6 -0
- data/druid.gemspec +30 -0
- data/features/area.feature +33 -0
- data/features/async.feature +16 -0
- data/features/audio.feature +61 -0
- data/features/bold.feature +20 -0
- data/features/button.feature +81 -0
- data/features/canvas.feature +34 -0
- data/features/checkbox.feature +48 -0
- data/features/div.feature +45 -0
- data/features/element.feature +281 -0
- data/features/file_field.feature +38 -0
- data/features/form.feature +37 -0
- data/features/frames.feature +76 -0
- data/features/generic_elements.feature +29 -0
- data/features/heading.feature +160 -0
- data/features/hidden_field.feature +39 -0
- data/features/html/async.html +31 -0
- data/features/html/frame_1.html +18 -0
- data/features/html/frame_2.html +16 -0
- data/features/html/frame_3.html +14 -0
- data/features/html/frames.html +12 -0
- data/features/html/hover.html +11 -0
- data/features/html/iframes.html +12 -0
- data/features/html/images/circle.png +0 -0
- data/features/html/images/img_pulpit.jpg +0 -0
- data/features/html/modal.html +17 -0
- data/features/html/modal_1.html +38 -0
- data/features/html/modal_2.html +27 -0
- data/features/html/multi_elements.html +145 -0
- data/features/html/nested_elements.html +75 -0
- data/features/html/nested_frame_1.html +1 -0
- data/features/html/nested_frame_2.html +11 -0
- data/features/html/nested_frame_3.html +14 -0
- data/features/html/nested_frames.html +10 -0
- data/features/html/planets.gif +0 -0
- data/features/html/static_elements.html +203 -0
- data/features/html/success.html +8 -0
- data/features/html/sun.gif +0 -0
- data/features/html/sun.html +7 -0
- data/features/image.feature +47 -0
- data/features/italic.feature +20 -0
- data/features/javascript.feature +28 -0
- data/features/label.feature +43 -0
- data/features/link.feature +56 -0
- data/features/list_item.feature +37 -0
- data/features/modal_dialog.feature +9 -0
- data/features/multi_elements.feature +498 -0
- data/features/nested_elements.feature +121 -0
- data/features/ordered_list.feature +46 -0
- data/features/page_level_actions.feature +116 -0
- data/features/paragraph.feature +33 -0
- data/features/populate_page_with.feature +25 -0
- data/features/radio_button.feature +51 -0
- data/features/radio_button_group.feature +28 -0
- data/features/sample-app/public/04-Death_Becomes_Fur.mp4 +0 -0
- data/features/sample-app/public/04-Death_Becomes_Fur.oga +0 -0
- data/features/sample-app/public/audio_video.html +19 -0
- data/features/sample-app/public/jquery-1.3.2.js +4376 -0
- data/features/sample-app/public/jquery.html +28 -0
- data/features/sample-app/public/movie.mp4 +0 -0
- data/features/sample-app/public/movie.ogg +0 -0
- data/features/sample-app/public/prototype-1.6.0.3.js +4320 -0
- data/features/sample-app/public/prototype.html +32 -0
- data/features/sample-app/sample_app.rb +35 -0
- data/features/section.feature +132 -0
- data/features/select_list.feature +84 -0
- data/features/span.feature +43 -0
- data/features/step_definations/area_steps.rb +23 -0
- data/features/step_definations/async_steps.rb +80 -0
- data/features/step_definations/audio_steps.rb +47 -0
- data/features/step_definations/bold_steps.rb +11 -0
- data/features/step_definations/button_steps.rb +52 -0
- data/features/step_definations/canvas_steps.rb +19 -0
- data/features/step_definations/checkbox_steps.rb +39 -0
- data/features/step_definations/div_steps.rb +28 -0
- data/features/step_definations/element_steps.rb +217 -0
- data/features/step_definations/file_field_steps.rb +31 -0
- data/features/step_definations/form_steps.rb +23 -0
- data/features/step_definations/frame_steps.rb +189 -0
- data/features/step_definations/generic_element_steps.rb +31 -0
- data/features/step_definations/heading_steps.rb +39 -0
- data/features/step_definations/hidden_field_steps.rb +27 -0
- data/features/step_definations/image_steps.rb +35 -0
- data/features/step_definations/italic_steps.rb +11 -0
- data/features/step_definations/javasript_steps.rb +52 -0
- data/features/step_definations/label_steps.rb +19 -0
- data/features/step_definations/link_steps.rb +42 -0
- data/features/step_definations/list_item_steps.rb +24 -0
- data/features/step_definations/modal_dialog_steps.rb +38 -0
- data/features/step_definations/multi_elements_steps.rb +557 -0
- data/features/step_definations/nested_elements_steps.rb +219 -0
- data/features/step_definations/ordered_list_steps.rb +49 -0
- data/features/step_definations/page_level_actions_steps.rb +172 -0
- data/features/step_definations/page_traversal_steps.rb +4 -0
- data/features/step_definations/paragraph_steps.rb +19 -0
- data/features/step_definations/populate_page_with_steps.rb +3 -0
- data/features/step_definations/radio_button_group_steps.rb +32 -0
- data/features/step_definations/radio_button_steps.rb +31 -0
- data/features/step_definations/section_steps.rb +271 -0
- data/features/step_definations/select_list_steps.rb +91 -0
- data/features/step_definations/span_steps.rb +23 -0
- data/features/step_definations/table_cell_steps.rb +27 -0
- data/features/step_definations/table_row_steps.rb +23 -0
- data/features/step_definations/table_steps.rb +109 -0
- data/features/step_definations/text_area_steps.rb +39 -0
- data/features/step_definations/text_field_steps.rb +39 -0
- data/features/step_definations/unordered_list_steps.rb +27 -0
- data/features/step_definations/video_steps.rb +27 -0
- data/features/support/ajax_test_environment.rb +26 -0
- data/features/support/audio_video_page.rb +23 -0
- data/features/support/env.rb +5 -0
- data/features/support/hooks.rb +3 -0
- data/features/support/page.rb +372 -0
- data/features/support/persistent_browser.rb +58 -0
- data/features/support/targets/firefox14_osx.rb +5 -0
- data/features/support/targets/firefox14_windows7.rb +5 -0
- data/features/support/url_helper.rb +50 -0
- data/features/table.feature +127 -0
- data/features/table_cell.feature +42 -0
- data/features/table_row.feature +30 -0
- data/features/text_area.feature +44 -0
- data/features/text_field.feature +53 -0
- data/features/unordered_list.feature +46 -0
- data/features/video.feature +66 -0
- data/lib/druid/accessors.rb +1082 -0
- data/lib/druid/assist.rb +653 -0
- data/lib/druid/element_locators.rb +21 -0
- data/lib/druid/elements/area.rb +9 -0
- data/lib/druid/elements/audio.rb +9 -0
- data/lib/druid/elements/bold.rb +8 -0
- data/lib/druid/elements/button.rb +12 -0
- data/lib/druid/elements/canvas.rb +9 -0
- data/lib/druid/elements/check_box.rb +9 -0
- data/lib/druid/elements/div.rb +9 -0
- data/lib/druid/elements/element.rb +187 -0
- data/lib/druid/elements/file_field.rb +9 -0
- data/lib/druid/elements/form.rb +9 -0
- data/lib/druid/elements/heading.rb +14 -0
- data/lib/druid/elements/hidden_field.rb +9 -0
- data/lib/druid/elements/image.rb +9 -0
- data/lib/druid/elements/italic.rb +9 -0
- data/lib/druid/elements/label.rb +8 -0
- data/lib/druid/elements/link.rb +9 -0
- data/lib/druid/elements/list_item.rb +9 -0
- data/lib/druid/elements/media.rb +11 -0
- data/lib/druid/elements/option.rb +9 -0
- data/lib/druid/elements/ordered_list.rb +29 -0
- data/lib/druid/elements/paragraph.rb +9 -0
- data/lib/druid/elements/radio_button.rb +9 -0
- data/lib/druid/elements/select_list.rb +30 -0
- data/lib/druid/elements/span.rb +9 -0
- data/lib/druid/elements/table.rb +92 -0
- data/lib/druid/elements/table_cell.rb +11 -0
- data/lib/druid/elements/table_row.rb +50 -0
- data/lib/druid/elements/text_area.rb +10 -0
- data/lib/druid/elements/text_field.rb +11 -0
- data/lib/druid/elements/unordered_list.rb +32 -0
- data/lib/druid/elements/video.rb +8 -0
- data/lib/druid/elements.rb +55 -0
- data/lib/druid/javascript/angularjs.rb +12 -0
- data/lib/druid/javascript/jquery.rb +12 -0
- data/lib/druid/javascript/prototype.rb +12 -0
- data/lib/druid/javascript/yui.rb +19 -0
- data/lib/druid/javascript_framework_facade.rb +76 -0
- data/lib/druid/locator_generator.rb +181 -0
- data/lib/druid/nested_elements.rb +56 -0
- data/lib/druid/page_factory.rb +115 -0
- data/lib/druid/page_populator.rb +104 -0
- data/lib/druid/section_collection.rb +17 -0
- data/lib/druid/version.rb +3 -0
- data/lib/druid.rb +452 -0
- data/spec/druid/accessors_spec.rb +1209 -0
- data/spec/druid/druid_spec.rb +295 -0
- data/spec/druid/element_locators_spec.rb +750 -0
- data/spec/druid/elements/bold_spec.rb +12 -0
- data/spec/druid/elements/button_spec.rb +23 -0
- data/spec/druid/elements/check_box_spec.rb +14 -0
- data/spec/druid/elements/div_spec.rb +10 -0
- data/spec/druid/elements/element_spec.rb +250 -0
- data/spec/druid/elements/file_field_spec.rb +13 -0
- data/spec/druid/elements/form_spec.rb +18 -0
- data/spec/druid/elements/heading_spec.rb +30 -0
- data/spec/druid/elements/hidden_field_spec.rb +10 -0
- data/spec/druid/elements/image_spec.rb +23 -0
- data/spec/druid/elements/itatic_spec.rb +11 -0
- data/spec/druid/elements/label_spec.rb +10 -0
- data/spec/druid/elements/link_spec.rb +10 -0
- data/spec/druid/elements/list_item_spec.rb +10 -0
- data/spec/druid/elements/media_spec.rb +12 -0
- data/spec/druid/elements/option_spec.rb +21 -0
- data/spec/druid/elements/ordered_list_spec.rb +38 -0
- data/spec/druid/elements/page_factory_spec.rb +40 -0
- data/spec/druid/elements/paragraph_spec.rb +12 -0
- data/spec/druid/elements/radio_button_spec.rb +14 -0
- data/spec/druid/elements/select_list_spec.rb +51 -0
- data/spec/druid/elements/span_spec.rb +10 -0
- data/spec/druid/elements/table_cell_spec.rb +14 -0
- data/spec/druid/elements/table_row_spec.rb +34 -0
- data/spec/druid/elements/table_spec.rb +47 -0
- data/spec/druid/elements/text_area_spec.rb +13 -0
- data/spec/druid/elements/text_field_spec.rb +22 -0
- data/spec/druid/elements/unordered_list_spec.rb +39 -0
- data/spec/druid/javascript_framework_facade_spec.rb +59 -0
- data/spec/druid/nested_element_spec.rb +128 -0
- data/spec/druid/page_factory_spec.rb +235 -0
- data/spec/druid/page_populator_spec.rb +173 -0
- data/spec/druid/page_section_spec.rb +70 -0
- data/spec/spec_helper.rb +9 -0
- metadata +517 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../sample-app/sample_app"
|
2
|
+
|
3
|
+
class AjaxTestEnvironment
|
4
|
+
def run
|
5
|
+
Thread.abort_on_exception = true
|
6
|
+
@example_app = Thread.new { SampleApp.start("127.0.0.1", 4567) }
|
7
|
+
|
8
|
+
poller = Selenium::WebDriver::SocketPoller.new("127.0.0.1", 4567, 60)
|
9
|
+
unless poller.connected?
|
10
|
+
raise "timed out waiting for SampleApp to launch"
|
11
|
+
end
|
12
|
+
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
def stop
|
17
|
+
@example_app.kill
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
@server = AjaxTestEnvironment.new
|
22
|
+
@server.run
|
23
|
+
|
24
|
+
at_exit do
|
25
|
+
@server.stop
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class AudioVideoPage
|
2
|
+
include Druid
|
3
|
+
|
4
|
+
page_url "http://localhost:4567/audio_video.html"
|
5
|
+
|
6
|
+
audio(:audio_id, :id => 'audio')
|
7
|
+
audio(:audio_name, :name => 'audio')
|
8
|
+
audio(:audio_class, :class => 'audio')
|
9
|
+
audio(:audio_index, :index => 0)
|
10
|
+
audio(:audio_xpath, :xpath => '//audio')
|
11
|
+
audio(:audio_css, :css => '.audio')
|
12
|
+
audio(:audio_class_index, :class => 'audio', :index => 0)
|
13
|
+
audio(:audio_name_index, :name => 'audio', :index => 0)
|
14
|
+
|
15
|
+
video(:video_id, :id => 'video')
|
16
|
+
video(:video_name, :name => 'video')
|
17
|
+
video(:video_class, :class => 'video')
|
18
|
+
video(:video_index, :index => 0)
|
19
|
+
video(:video_xpath, :xpath => '//video')
|
20
|
+
video(:video_css, :css => '.video')
|
21
|
+
video(:video_class_index, :class => 'video', :index => 0)
|
22
|
+
video(:video_name_index, :name => 'video', :index => 0)
|
23
|
+
end
|
@@ -0,0 +1,372 @@
|
|
1
|
+
class Page
|
2
|
+
include Druid
|
3
|
+
|
4
|
+
expected_title "Static Elements Page"
|
5
|
+
expected_element :hello0
|
6
|
+
|
7
|
+
page_url("http://www.baidu.com")
|
8
|
+
|
9
|
+
link(:google_search_id, :id => "link_id")
|
10
|
+
link(:google_search_name, :name => "link_name")
|
11
|
+
link(:google_search_class, :class => "link_class")
|
12
|
+
link(:google_search_xpath, :xpath => "//a[text()='Google Search']")
|
13
|
+
link(:google_search_href, :href => "success.html")
|
14
|
+
link(:google_search_text, :text => "Google Search")
|
15
|
+
link(:google_search_index, :index => 0)
|
16
|
+
link(:google_search_link, :link => "Google Search")
|
17
|
+
link(:google_search_link_text, :link_text => "Google Search")
|
18
|
+
link(:google_search_css, :css => "a.link_class")
|
19
|
+
link(:google_search_title, :title => "link_title")
|
20
|
+
link(:hello0, {:text => "Hello", :index => 0})
|
21
|
+
link(:hello1, {:text => "Hello", :index => 1})
|
22
|
+
link(:hello2, {:text => "Hello", :index => 2})
|
23
|
+
|
24
|
+
text_field(:text_field_id, :id => "text_field_id")
|
25
|
+
text_field(:text_field_class, :class => "text_field_class")
|
26
|
+
text_field(:text_field_name, :name => "text_field_name")
|
27
|
+
text_field(:text_field_xpath, :xpath => "//input[@type='text']")
|
28
|
+
text_field(:text_field_css, :css => "input[type='text']")
|
29
|
+
text_field(:text_field_tag_name, :tag_name => "input[type='text']")
|
30
|
+
text_field(:text_field_index, :index => 0)
|
31
|
+
text_field(:text_field_text, :text => "")
|
32
|
+
text_field(:text_field_value, :value => "")
|
33
|
+
text_field(:text_field_title, :title => "text_field_title")
|
34
|
+
text_field(:text_field_label, :label => "Text Field")
|
35
|
+
text_field(:text_field_data_field, :data_field => 'title')
|
36
|
+
text_field(:text_field_class_index, :class => "text_field_class", :index => 0)
|
37
|
+
text_field(:text_field_name_index, :name => "text_field_name", :index => 0)
|
38
|
+
text_field(:text_field_onfocus, :id => "onfocus_text_field")
|
39
|
+
text_field(:text_field_unfocus, :id => "unfocus_text_field")
|
40
|
+
|
41
|
+
|
42
|
+
checkbox(:cb_id, :id => "cb_id")
|
43
|
+
checkbox(:cb_name, :name => 'cb_name')
|
44
|
+
checkbox(:cb_class, :class => 'cb_class')
|
45
|
+
checkbox(:cb_index, :index => 0)
|
46
|
+
checkbox(:cb_value, :value => '1')
|
47
|
+
checkbox(:cb_xpath, :xpath => "//input[@type='checkbox']")
|
48
|
+
checkbox(:cb_label, :label => 'Checkbox')
|
49
|
+
checkbox(:cb_css, :css => '.cb_class')
|
50
|
+
checkbox(:cb_class_index, :class => "cb_class", :index => 0)
|
51
|
+
checkbox(:cb_name_index, :name => "cb_name", :index => 0)
|
52
|
+
|
53
|
+
select_list(:select_list_id, :id => "sel_list_id")
|
54
|
+
select_list(:select_list_class, :class => "sel_list_class")
|
55
|
+
select_list(:select_list_index, :index => 0)
|
56
|
+
select_list(:select_list_name, :name => "sel_list_name")
|
57
|
+
select_list(:select_list_xpath, :xpath => "//select")
|
58
|
+
select_list(:select_list_text, :text => "Test 1")
|
59
|
+
select_list(:select_list_value, :value => "option1")
|
60
|
+
select_list(:select_list_multiple, :id => "sel_list_multiple")
|
61
|
+
select_list(:select_list_label, :label => "Select List")
|
62
|
+
select_list(:select_list_css, :css => '.sel_list_class')
|
63
|
+
select_list(:select_list_class_index, :class => "sel_list_class", :index => 0)
|
64
|
+
select_list(:select_list_name_index, :name => "sel_list_name", :index => 0)
|
65
|
+
|
66
|
+
radio_button(:milk_id, :id => 'milk_id')
|
67
|
+
radio_button(:butter_id, :id => 'butter_id')
|
68
|
+
radio_button(:milk_name, :name => 'milk_name')
|
69
|
+
radio_button(:milk_class, :class => 'milk_class')
|
70
|
+
radio_button(:milk_index, :index => 0)
|
71
|
+
radio_button(:milk_value, :value => 'Milk')
|
72
|
+
radio_button(:milk_xpath, :xpath => "//input[@type='radio']")
|
73
|
+
radio_button(:milk_label, :label => "Radio")
|
74
|
+
radio_button(:milk_css, :css => '.milk_class')
|
75
|
+
radio_button(:milk_class_index, :class => "milk_class", :index => 0)
|
76
|
+
radio_button(:milk_name_index, :name => "milk_name", :index => 0)
|
77
|
+
|
78
|
+
radio_button_group(:favorite_cheese, name: 'fav_cheese')
|
79
|
+
|
80
|
+
button(:button_id, :id => 'button_id')
|
81
|
+
button(:button_name, :name => 'button_name')
|
82
|
+
button(:button_class, :class => 'button_class')
|
83
|
+
button(:button_index, :index => 0)
|
84
|
+
button(:button_xpath, :xpath=> "//input[@type='submit']")
|
85
|
+
button(:button_text, :text => 'Click Me')
|
86
|
+
button(:button_value, :value => 'Click Me')
|
87
|
+
button(:button_class_index, :class => "button_class", :index => 0)
|
88
|
+
button(:button_name_index, :name => "button_name", :index => 0)
|
89
|
+
button(:button_css, :css => ".button_class")
|
90
|
+
|
91
|
+
button(:button_image_id, :id => 'button_image_id')
|
92
|
+
button(:button_image_src, :src => 'images/submit.gif')
|
93
|
+
button(:button_image_alt, :alt => 'Submit')
|
94
|
+
|
95
|
+
button(:disabled_button, :value => 'Disabled')
|
96
|
+
|
97
|
+
button(:btn_id, :id => 'btn_id')
|
98
|
+
button(:btn_name, :name => 'btn_name')
|
99
|
+
button(:btn_class, :class => 'btn_class')
|
100
|
+
button(:btn_index, :index => 0)
|
101
|
+
button(:btn_text, :text => 'Click Me Too')
|
102
|
+
button(:btn_value, :value => 'Click Me Too')
|
103
|
+
button(:btn_class_index, :class => "btn_class", :index => 0)
|
104
|
+
button(:btn_name_index, :name => "btn_name", :index => 0)
|
105
|
+
|
106
|
+
div(:div_id, :id => "div_id")
|
107
|
+
div(:div_name, :name => "div_name")
|
108
|
+
div(:div_class, :class => 'div_class')
|
109
|
+
div(:div_index, :index => 0)
|
110
|
+
div(:div_xpath, :xpath => '//div')
|
111
|
+
div(:div_text, :text => "page-object rocks!")
|
112
|
+
div(:div_title, :title => "div_title")
|
113
|
+
div(:div_css, :css => '.div_class')
|
114
|
+
div(:div_data_entity, :data_entity => "test")
|
115
|
+
div(:div_class_index, :class => "div_class", :index => 0)
|
116
|
+
div(:div_name_index, :name => "div_name", :index => 0)
|
117
|
+
|
118
|
+
table(:table_id, :id => "table_id")
|
119
|
+
table(:table_class, :class => 'table_class')
|
120
|
+
table(:table_index, :index => 0)
|
121
|
+
table(:table_xpath, :xpath => '//table')
|
122
|
+
table(:table_name, :name => 'table_name')
|
123
|
+
table(:table_with_thead_id, :id => 'table_with_thead_id')
|
124
|
+
table(:table_css, :css => '.table_class')
|
125
|
+
table(:table_class_index, :class => "table_class", :index => 0)
|
126
|
+
table(:table_name_index, :name => "table_name", :index => 0)
|
127
|
+
table(:table_with_regex, :id => 'table_with_regex')
|
128
|
+
|
129
|
+
|
130
|
+
cell(:cell_id, :id => 'cell_id')
|
131
|
+
cell(:cell_class, :class => 'cell_class')
|
132
|
+
cell(:cell_index, :index => 3)
|
133
|
+
cell(:cell_xpath, :xpath => '//table//tr[2]//td[2]')
|
134
|
+
cell(:cell_name, :name => 'cell_name')
|
135
|
+
cell(:cell_text, :text => 'Data4')
|
136
|
+
cell(:cell_css, :css => '.cell_class')
|
137
|
+
cell(:cell_class_index, :class => "cell_class", :index => 0)
|
138
|
+
cell(:cell_name_index, :name => "cell_name", :index => 0)
|
139
|
+
|
140
|
+
span(:span_id, :id => "span_id")
|
141
|
+
span(:span_class, :class => 'span_class')
|
142
|
+
span(:span_index, :index => 0)
|
143
|
+
span(:span_xpath, :xpath => '//span')
|
144
|
+
span(:span_name, :name => 'span_name')
|
145
|
+
span(:span_text, :text => 'My alert')
|
146
|
+
span(:span_title, :title => 'span_title')
|
147
|
+
span(:span_css, :css => '.span_class')
|
148
|
+
span(:span_class_index, :class => "span_class", :index => 0)
|
149
|
+
span(:span_name_index, :name => "span_name", :index => 0)
|
150
|
+
|
151
|
+
label(:label_id, :id => "label_id")
|
152
|
+
label(:label_name, :name => "label_name")
|
153
|
+
label(:label_class, :class => "label_class")
|
154
|
+
label(:label_text, :text => "page-object is the best!")
|
155
|
+
label(:label_index, :index => 6)
|
156
|
+
label(:label_xpath, :xpath => "//label[7]")
|
157
|
+
label(:label_css, :css => '.label_class')
|
158
|
+
label(:label_class_index, :class => "label_class", :index => 0)
|
159
|
+
label(:label_name_index, :name => "label_name", :index => 0)
|
160
|
+
|
161
|
+
image(:image_id, :id => "image_id")
|
162
|
+
image(:image_name, :name => 'image_name')
|
163
|
+
image(:image_class, :class => 'image_class')
|
164
|
+
image(:image_index, :index => 1)
|
165
|
+
image(:image_xpath, :xpath => '//img[2]')
|
166
|
+
image(:image_alt, :alt => 'image_alt')
|
167
|
+
image(:image_src, :src => 'images/circle.png')
|
168
|
+
image(:image_css, :css => '.image_class')
|
169
|
+
image(:image_class_index, :class => "image_class", :index => 0)
|
170
|
+
image(:image_name_index, :name => "image_name", :index => 0)
|
171
|
+
|
172
|
+
form(:form_id, :id => 'form_id')
|
173
|
+
form(:form_name, :id => 'form_name')
|
174
|
+
form(:form_class, :class => 'form_class')
|
175
|
+
form(:form_index, :index => 0)
|
176
|
+
form(:form_xpath, :xpath => '//form')
|
177
|
+
form(:form_action, :action => 'success.html')
|
178
|
+
form(:form_css, :css => '.form_class')
|
179
|
+
form(:form_class_index, :class => "form_class", :index => 0)
|
180
|
+
form(:form_name_index, :name => "form_name", :index => 0)
|
181
|
+
|
182
|
+
hidden_field(:hidden_field_id, :id => "hidden_field_id")
|
183
|
+
hidden_field(:hidden_field_class, :class => "hidden_field_class")
|
184
|
+
hidden_field(:hidden_field_name, :name => "hidden_field_name")
|
185
|
+
hidden_field(:hidden_field_xpath, :xpath => "//input[@type='hidden']")
|
186
|
+
hidden_field(:hidden_field_css, :css => ".hidden_field_class")
|
187
|
+
hidden_field(:hidden_field_tag_name, :tag_name => "input[type='hidden']")
|
188
|
+
hidden_field(:hidden_field_index, :index => 0)
|
189
|
+
hidden_field(:hidden_field_text, :text => "")
|
190
|
+
hidden_field(:hidden_field_value, :value => "12345")
|
191
|
+
hidden_field(:hidden_field_class_index, :class => "hidden_field_class", :index => 0)
|
192
|
+
hidden_field(:hidden_field_name_index, :name => "hidden_field_name", :index => 0)
|
193
|
+
|
194
|
+
list_item(:li_id, :id => 'li_id')
|
195
|
+
list_item(:li_class, :class => 'li_class')
|
196
|
+
list_item(:li_name, :name => 'li_name')
|
197
|
+
list_item(:li_index, :index => 0)
|
198
|
+
list_item(:li_xpath, :xpath => '//li[1]')
|
199
|
+
list_item(:li_text, :text => 'Item One')
|
200
|
+
list_item(:li_css, :css => '.li_class')
|
201
|
+
list_item(:li_class_index, :class => "li_class", :index => 0)
|
202
|
+
list_item(:li_name_index, :name => "li_name", :index => 0)
|
203
|
+
|
204
|
+
ordered_list(:ol_id, :id => 'ol_id')
|
205
|
+
ordered_list(:ol_class, :class => 'ol_class')
|
206
|
+
ordered_list(:ol_index, :index => 0)
|
207
|
+
ordered_list(:ol_xpath, :xpath => '//ol')
|
208
|
+
ordered_list(:ol_name, :name => 'ol_name')
|
209
|
+
ordered_list(:ol_css, :css => '.ol_class')
|
210
|
+
ordered_list(:ol_class_index, :class => "ol_class", :index => 0)
|
211
|
+
ordered_list(:ol_name_index, :name => "ol_name", :index => 0)
|
212
|
+
|
213
|
+
text_area(:text_area_id, :id => "text_area_id")
|
214
|
+
text_area(:text_area_class, :class => "text_area_class")
|
215
|
+
text_area(:text_area_name, :name => "text_area_name")
|
216
|
+
text_area(:text_area_xpath, :xpath => "//textarea")
|
217
|
+
text_area(:text_area_css, :css => ".text_area_class")
|
218
|
+
text_area(:text_area_tag_name, :tag_name => "textarea")
|
219
|
+
text_area(:text_area_index, :index => 0)
|
220
|
+
text_area(:text_area_text, :text => "")
|
221
|
+
text_area(:text_area_value, :value => "")
|
222
|
+
text_area(:text_area_label, :label => "Text Area")
|
223
|
+
text_area(:text_area_class_index, :class => "text_area_class", :index => 0)
|
224
|
+
text_area(:text_area_name_index, :name => "text_area_name", :index => 0)
|
225
|
+
|
226
|
+
unordered_list(:ul_id, :id => 'ul_id')
|
227
|
+
unordered_list(:ul_class, :class => 'ul_class')
|
228
|
+
unordered_list(:ul_index, :index => 0)
|
229
|
+
unordered_list(:ul_xpath, :xpath => '//ul')
|
230
|
+
unordered_list(:ul_name, :name => 'ul_name')
|
231
|
+
unordered_list(:ul_css, :css => '.ul_class')
|
232
|
+
unordered_list(:ul_class_index, :class => "ul_class", :index => 0)
|
233
|
+
unordered_list(:ul_name_index, :name => "ul_name", :index => 0)
|
234
|
+
unordered_list(:ul_class_name, :class => "ul_class", :name => "ul_name")
|
235
|
+
|
236
|
+
button(:alert_button, :id => "alert_button")
|
237
|
+
button(:alert_button_that_reloads, :id => 'alert_button_that_reloads')
|
238
|
+
button(:confirm_button, :id => "confirm_button")
|
239
|
+
button(:confirm_button_that_reloads, :id => 'confirm_button_that_reloads')
|
240
|
+
button(:prompt_button, :id => "prompt_button")
|
241
|
+
|
242
|
+
link(:open_window, :text => 'New Window')
|
243
|
+
|
244
|
+
h1(:h1_id, :id => 'h1_id')
|
245
|
+
h1(:h1_class, :class => 'h1_class')
|
246
|
+
h1(:h1_name, :name => 'h1_name')
|
247
|
+
h1(:h1_index, :index => 0)
|
248
|
+
h1(:h1_xpath, :xpath => '//h1')
|
249
|
+
h1(:h1_css, :css => '.h1_class')
|
250
|
+
h1(:h1_class_index, :class => 'h1_class', :index => 0)
|
251
|
+
h1(:h1_name_index, :name => 'h1_name', :index => 0)
|
252
|
+
|
253
|
+
h2(:h2_id, :id => 'h2_id')
|
254
|
+
h2(:h2_class, :class => 'h2_class')
|
255
|
+
h2(:h2_name, :name => 'h2_name')
|
256
|
+
h2(:h2_index, :index => 0)
|
257
|
+
h2(:h2_xpath, :xpath => '//h2')
|
258
|
+
h2(:h2_css, :css => '.h2_class')
|
259
|
+
h2(:h2_class_index, :class => 'h2_class', :index => 0)
|
260
|
+
h2(:h2_name_index, :name => 'h2_name', :index =>0)
|
261
|
+
|
262
|
+
h3(:h3_id, :id => 'h3_id')
|
263
|
+
h3(:h3_class, :class => 'h3_class')
|
264
|
+
h3(:h3_name, :name => 'h3_name')
|
265
|
+
h3(:h3_index, :index => 0)
|
266
|
+
h3(:h3_xpath, :xpath => '//h3')
|
267
|
+
h3(:h3_css, :css => '.h3_class')
|
268
|
+
h3(:h3_class_index, :class => 'h3_class', :index => 0)
|
269
|
+
h3(:h3_name_index, :name => 'h3_name', :index => 0)
|
270
|
+
|
271
|
+
h4(:h4_id, :id => 'h4_id')
|
272
|
+
h4(:h4_class, :class => 'h4_class')
|
273
|
+
h4(:h4_name, :name => 'h4_name')
|
274
|
+
h4(:h4_index, :index => 0)
|
275
|
+
h4(:h4_xpath, :xpath => '//h4')
|
276
|
+
h4(:h4_css, :css => '.h4_class')
|
277
|
+
h4(:h4_class_index, :class => 'h4_class', :index => 0)
|
278
|
+
h4(:h4_name_index, :name => 'h4_name', :index => 0)
|
279
|
+
|
280
|
+
h5(:h5_id, :id => 'h5_id')
|
281
|
+
h5(:h5_class, :class => 'h5_class')
|
282
|
+
h5(:h5_name, :name => 'h5_name')
|
283
|
+
h5(:h5_index, :index => 0)
|
284
|
+
h5(:h5_xpath, :xpath => '//h5')
|
285
|
+
h5(:h5_css, :css => '.h5_class')
|
286
|
+
h5(:h5_class_index, :class => 'h5_class', :index => 0)
|
287
|
+
h5(:h5_name_index, :name => 'h5_name', :index => 0)
|
288
|
+
|
289
|
+
h6(:h6_id, :id => 'h6_id')
|
290
|
+
h6(:h6_class, :class => 'h6_class')
|
291
|
+
h6(:h6_name, :name => 'h6_name')
|
292
|
+
h6(:h6_index, :index => 0)
|
293
|
+
h6(:h6_xpath, :xpath => '//h6')
|
294
|
+
h6(:h6_css, :css => '.h6_class')
|
295
|
+
h6(:h6_class_index, :class => 'h6_class', :index => 0)
|
296
|
+
h6(:h6_name_index, :name => 'h6_name', :index => 0)
|
297
|
+
|
298
|
+
paragraph(:p_id, :id => 'p_id')
|
299
|
+
paragraph(:p_class, :class => 'p_class')
|
300
|
+
paragraph(:p_name, :name => 'p_name')
|
301
|
+
paragraph(:p_index, :index => 0)
|
302
|
+
paragraph(:p_xpath, :xpath => '//p')
|
303
|
+
paragraph(:p_css, :css => '.p_class')
|
304
|
+
paragraph(:p_class_index, :class => 'p_class', :index => 0)
|
305
|
+
paragraph(:p_name_index, :name => 'p_name', :index => 0)
|
306
|
+
|
307
|
+
file_field(:file_field_id, :id => 'file_field_id')
|
308
|
+
file_field(:file_field_name, :name => 'file_field_name')
|
309
|
+
file_field(:file_field_class, :class => 'file_field_class')
|
310
|
+
file_field(:file_field_index, :index => 0)
|
311
|
+
file_field(:file_field_title, :title => 'file_field_title')
|
312
|
+
file_field(:file_field_xpath, :xpath => "//input[@type='file']")
|
313
|
+
file_field(:file_field_label, :label => "File Field")
|
314
|
+
file_field(:file_field_css, :css => '.file_field_class')
|
315
|
+
file_field(:file_field_class_index, :class => 'file_field_class', :index => 0)
|
316
|
+
file_field(:file_field_name_index, :name => 'file_field_name', :index => 0)
|
317
|
+
|
318
|
+
link(:child, :id => 'child')
|
319
|
+
|
320
|
+
area(:area_id, :id => 'area')
|
321
|
+
area(:area_name, :name => 'area')
|
322
|
+
area(:area_class, :class => 'area')
|
323
|
+
area(:area_index, :index => 0)
|
324
|
+
area(:area_xpath, :xpath => '//area')
|
325
|
+
area(:area_css, :css => '.area')
|
326
|
+
area(:area_class_index, :class => 'area', :index => 0)
|
327
|
+
area(:area_name_index, :name => 'area', :index => 0)
|
328
|
+
|
329
|
+
canvas(:canvas_id, :id => 'canvas')
|
330
|
+
canvas(:canvas_name, :name => 'canvas')
|
331
|
+
canvas(:canvas_class, :class => 'canvas')
|
332
|
+
canvas(:canvas_index, :index => 0)
|
333
|
+
canvas(:canvas_xpath, :xpath => '//canvas')
|
334
|
+
canvas(:canvas_css, :css => '.canvas')
|
335
|
+
canvas(:canvas_class_index, :class => 'canvas', :index => 0)
|
336
|
+
canvas(:canvas_name_index, :name => 'canvas', :index => 0)
|
337
|
+
|
338
|
+
element(:article_id, :article, :id => 'article_id')
|
339
|
+
element(:header_id, :header, :id => 'header_id')
|
340
|
+
element(:footer_id, :footer, :id => 'footer_id')
|
341
|
+
element(:summary_id, :summary, :id => 'summary_id')
|
342
|
+
element(:details_id, :details, :id => 'details_id')
|
343
|
+
|
344
|
+
figure(:figure_id, :id => 'figure_id')
|
345
|
+
svg(:svg_id, :id => 'the_svg')
|
346
|
+
|
347
|
+
b(:b_id, :id => 'b_id')
|
348
|
+
b(:b_class, :class => 'b_class')
|
349
|
+
b(:b_css, :css => '.b_class')
|
350
|
+
b(:b_name, :name => 'b_name')
|
351
|
+
b(:b_index, :index => 0)
|
352
|
+
b(:b_xpath, :xpath => '//b')
|
353
|
+
b(:b_class_index, :class => 'b_class', :index => 0)
|
354
|
+
b(:b_name_index, :name => 'b_name', :index => 0)
|
355
|
+
|
356
|
+
row(:tr_id, :id => 'tr_id')
|
357
|
+
row(:tr_class, :class => 'tr_class')
|
358
|
+
row(:tr_css, :css => '.tr_class')
|
359
|
+
row(:tr_index, :index => 1)
|
360
|
+
row(:tr_text, :text => 'Data1 Data2')
|
361
|
+
row(:tr_xpath, :xpath => '//table//tbody//tr[1]')
|
362
|
+
row(:tr_class_index, :class => 'tr_class', :index => 0)
|
363
|
+
|
364
|
+
i(:i_id, :id => 'i_id')
|
365
|
+
i(:i_class, :class => 'i_class')
|
366
|
+
i(:i_css, :css => '.i_class')
|
367
|
+
i(:i_name, :name => 'i_name')
|
368
|
+
i(:i_index, :index => 0)
|
369
|
+
i(:i_xpath, :xpath => '//i')
|
370
|
+
i(:i_class_index, :class => 'i_class', :index => 0)
|
371
|
+
i(:i_name_index, :name => 'i_name', :index => 0)
|
372
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'selenium/webdriver/remote/http/default'
|
2
|
+
|
3
|
+
module Druid
|
4
|
+
module PersistantBrowser
|
5
|
+
@@driver = false
|
6
|
+
def self.get_browser
|
7
|
+
if !@@driver
|
8
|
+
target = ENV['BROWSER'] || 'local_chrome'
|
9
|
+
|
10
|
+
if is_remote?(target)
|
11
|
+
require File.dirname(__FILE__) + "/targets/#{target}"
|
12
|
+
extend Target
|
13
|
+
end
|
14
|
+
|
15
|
+
@@driver = watir_browser(target) if ENV['DRIVER'] == 'WATIR'
|
16
|
+
end
|
17
|
+
@@driver
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.quit
|
21
|
+
@@driver.quit
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def self.is_remote?(target)
|
27
|
+
not target.include? 'local'
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.watir_browser(target)
|
31
|
+
if is_remote?(target)
|
32
|
+
Watir::Browser.new(:remote,
|
33
|
+
:http_client => client,
|
34
|
+
:url => url,
|
35
|
+
:desired_capabilities => desired_capabilities )
|
36
|
+
else
|
37
|
+
browser = target.gsub('local_', '').to_sym
|
38
|
+
Watir::Browser.new browser, :http_client => client
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.client
|
43
|
+
Selenium::WebDriver::Remote::Http::Default.new
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.capabilities(browser, version, platform, name)
|
47
|
+
caps = Selenium::WebDriver::Remote::Capabilities.send browser
|
48
|
+
caps.version = version
|
49
|
+
caps.platform = platform
|
50
|
+
caps[:name] = name
|
51
|
+
caps
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.url
|
55
|
+
"http://pageobject:18002ee8-963b-472e-9425-2baf0a2b6d95@ondemand.saucelabs.com:80/wd/hub"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module UrlHelper
|
2
|
+
class << self
|
3
|
+
def html
|
4
|
+
File.expand_path("#{File.dirname(__FILE__)}/../html")
|
5
|
+
end
|
6
|
+
|
7
|
+
def files
|
8
|
+
target = ENV['BROWSER']
|
9
|
+
return "file://#{html}" if target.nil? or target.include? 'local'
|
10
|
+
'http://ec2-107-22-131-88.compute-1.amazonaws.com'
|
11
|
+
end
|
12
|
+
|
13
|
+
def static_elements
|
14
|
+
"#{files}/static_elements.html"
|
15
|
+
end
|
16
|
+
|
17
|
+
def frame_elements
|
18
|
+
"#{files}/frames.html"
|
19
|
+
end
|
20
|
+
|
21
|
+
def iframe_elements
|
22
|
+
"#{files}/iframes.html"
|
23
|
+
end
|
24
|
+
|
25
|
+
def nested_frame_elements
|
26
|
+
"#{files}/nested_frames.html"
|
27
|
+
end
|
28
|
+
|
29
|
+
def nested_elements
|
30
|
+
"#{files}/nested_elements.html"
|
31
|
+
end
|
32
|
+
|
33
|
+
def modal
|
34
|
+
"#{files}/modal.html"
|
35
|
+
end
|
36
|
+
|
37
|
+
def async
|
38
|
+
"#{files}/async.html"
|
39
|
+
end
|
40
|
+
|
41
|
+
def multi
|
42
|
+
"#{files}/multi_elements.html"
|
43
|
+
end
|
44
|
+
|
45
|
+
def hover
|
46
|
+
"#{files}/hover.html"
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|