watir 6.10.0 → 6.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +5 -5
- data/.github/ISSUE_TEMPLATE.md +16 -16
- data/.gitignore +21 -21
- data/.travis.yml +72 -72
- data/CHANGES.md +6 -0
- data/Gemfile +16 -16
- data/LICENSE +23 -23
- data/README.md +106 -106
- data/Rakefile +153 -153
- data/appveyor.yml +13 -13
- data/lib/watir-webdriver.rb +2 -2
- data/lib/watir.rb +158 -158
- data/lib/watir/adjacent.rb +126 -126
- data/lib/watir/after_hooks.rb +132 -132
- data/lib/watir/alert.rb +120 -120
- data/lib/watir/aliases.rb +6 -6
- data/lib/watir/attribute_helper.rb +96 -96
- data/lib/watir/browser.rb +349 -349
- data/lib/watir/capabilities.rb +123 -123
- data/lib/watir/cell_container.rb +25 -25
- data/lib/watir/container.rb +51 -51
- data/lib/watir/cookies.rb +134 -134
- data/lib/watir/element_collection.rb +138 -138
- data/lib/watir/elements/area.rb +12 -12
- data/lib/watir/elements/button.rb +37 -37
- data/lib/watir/elements/cell.rb +17 -17
- data/lib/watir/elements/checkbox.rb +56 -56
- data/lib/watir/elements/dlist.rb +12 -12
- data/lib/watir/elements/element.rb +6 -5
- data/lib/watir/elements/file_field.rb +41 -41
- data/lib/watir/elements/font.rb +25 -25
- data/lib/watir/elements/form.rb +16 -16
- data/lib/watir/elements/hidden.rb +25 -25
- data/lib/watir/elements/html_elements.rb +2035 -2035
- data/lib/watir/elements/iframe.rb +166 -166
- data/lib/watir/elements/image.rb +21 -21
- data/lib/watir/elements/input.rb +15 -15
- data/lib/watir/elements/link.rb +18 -18
- data/lib/watir/elements/list.rb +49 -49
- data/lib/watir/elements/option.rb +72 -72
- data/lib/watir/elements/radio.rb +60 -60
- data/lib/watir/elements/row.rb +17 -17
- data/lib/watir/elements/select.rb +250 -250
- data/lib/watir/elements/svg_elements.rb +613 -613
- data/lib/watir/elements/table.rb +76 -76
- data/lib/watir/elements/table_cell.rb +31 -31
- data/lib/watir/elements/table_row.rb +32 -32
- data/lib/watir/elements/table_section.rb +15 -15
- data/lib/watir/elements/text_area.rb +5 -5
- data/lib/watir/elements/text_field.rb +39 -39
- data/lib/watir/exception.rb +16 -16
- data/lib/watir/extensions/nokogiri.rb +14 -14
- data/lib/watir/generator.rb +3 -3
- data/lib/watir/generator/base.rb +11 -11
- data/lib/watir/generator/base/generator.rb +115 -115
- data/lib/watir/generator/base/idl_sorter.rb +47 -47
- data/lib/watir/generator/base/spec_extractor.rb +138 -138
- data/lib/watir/generator/base/util.rb +21 -21
- data/lib/watir/generator/base/visitor.rb +162 -162
- data/lib/watir/generator/html.rb +15 -15
- data/lib/watir/generator/html/generator.rb +36 -36
- data/lib/watir/generator/html/spec_extractor.rb +50 -50
- data/lib/watir/generator/html/visitor.rb +21 -21
- data/lib/watir/generator/svg.rb +7 -7
- data/lib/watir/generator/svg/generator.rb +38 -38
- data/lib/watir/generator/svg/spec_extractor.rb +53 -53
- data/lib/watir/generator/svg/visitor.rb +21 -21
- data/lib/watir/has_window.rb +68 -68
- data/lib/watir/js_execution.rb +143 -143
- data/lib/watir/js_snippets.rb +16 -16
- data/lib/watir/js_snippets/backgroundColor.js +7 -7
- data/lib/watir/js_snippets/fireEvent.js +31 -31
- data/lib/watir/js_snippets/focus.js +3 -3
- data/lib/watir/js_snippets/getInnerHtml.js +19 -19
- data/lib/watir/js_snippets/getInnerText.js +19 -19
- data/lib/watir/js_snippets/getOuterHtml.js +20 -20
- data/lib/watir/js_snippets/getTextContent.js +19 -19
- data/lib/watir/js_snippets/isImageLoaded.js +3 -3
- data/lib/watir/js_snippets/selectOptionsLabel.js +10 -10
- data/lib/watir/js_snippets/selectOptionsText.js +10 -10
- data/lib/watir/js_snippets/selectOptionsValue.js +10 -10
- data/lib/watir/js_snippets/selectText.js +64 -64
- data/lib/watir/js_snippets/selectedOptions.js +11 -11
- data/lib/watir/js_snippets/setValue.js +3 -3
- data/lib/watir/legacy_wait.rb +126 -126
- data/lib/watir/locators.rb +60 -60
- data/lib/watir/locators/button/locator.rb +31 -31
- data/lib/watir/locators/button/selector_builder.rb +30 -30
- data/lib/watir/locators/button/selector_builder/xpath.rb +29 -29
- data/lib/watir/locators/button/validator.rb +15 -15
- data/lib/watir/locators/cell/locator.rb +15 -15
- data/lib/watir/locators/cell/selector_builder.rb +24 -24
- data/lib/watir/locators/element/locator.rb +1 -0
- data/lib/watir/locators/element/selector_builder.rb +150 -150
- data/lib/watir/locators/element/selector_builder/xpath.rb +119 -119
- data/lib/watir/locators/element/validator.rb +18 -18
- data/lib/watir/locators/row/locator.rb +15 -15
- data/lib/watir/locators/row/selector_builder.rb +29 -29
- data/lib/watir/locators/text_area/locator.rb +13 -13
- data/lib/watir/locators/text_area/selector_builder.rb +22 -22
- data/lib/watir/locators/text_field/locator.rb +30 -30
- data/lib/watir/locators/text_field/selector_builder.rb +31 -31
- data/lib/watir/locators/text_field/selector_builder/xpath.rb +17 -17
- data/lib/watir/locators/text_field/validator.rb +12 -12
- data/lib/watir/logger.rb +109 -109
- data/lib/watir/radio_set.rb +231 -231
- data/lib/watir/row_container.rb +36 -36
- data/lib/watir/screenshot.rb +50 -50
- data/lib/watir/user_editable.rb +56 -56
- data/lib/watir/wait.rb +200 -200
- data/lib/watir/wait/timer.rb +52 -52
- data/lib/watir/window.rb +257 -257
- data/lib/watir/xpath_support.rb +20 -20
- data/lib/watirspec.rb +86 -86
- data/lib/watirspec/guards.rb +60 -60
- data/lib/watirspec/implementation.rb +51 -51
- data/lib/watirspec/rake_tasks.rb +115 -115
- data/lib/watirspec/remote_server.rb +38 -38
- data/lib/watirspec/runner.rb +53 -53
- data/lib/watirspec/server.rb +99 -99
- data/lib/watirspec/server/app.rb +76 -76
- data/spec/browser_spec.rb +278 -278
- data/spec/click_spec.rb +19 -19
- data/spec/container_spec.rb +34 -34
- data/spec/element_locator_spec.rb +517 -517
- data/spec/element_spec.rb +158 -158
- data/spec/implementation_spec.rb +24 -24
- data/spec/input_spec.rb +14 -14
- data/spec/locator_spec_helper.rb +55 -55
- data/spec/logger_spec.rb +46 -46
- data/spec/spec_helper.rb +22 -22
- data/spec/special_chars_spec.rb +13 -13
- data/spec/watirspec/adjacent_spec.rb +227 -227
- data/spec/watirspec/after_hooks_spec.rb +182 -182
- data/spec/watirspec/alert_spec.rb +108 -108
- data/spec/watirspec/attributes_spec.rb +16 -16
- data/spec/watirspec/browser_spec.rb +281 -281
- data/spec/watirspec/cookies_spec.rb +154 -154
- data/spec/watirspec/drag_and_drop_spec.rb +49 -49
- data/spec/watirspec/element_hidden_spec.rb +75 -75
- data/spec/watirspec/elements/area_spec.rb +72 -72
- data/spec/watirspec/elements/areas_spec.rb +42 -42
- data/spec/watirspec/elements/button_spec.rb +277 -277
- data/spec/watirspec/elements/buttons_spec.rb +55 -55
- data/spec/watirspec/elements/checkbox_spec.rb +275 -275
- data/spec/watirspec/elements/checkboxes_spec.rb +44 -44
- data/spec/watirspec/elements/collections_spec.rb +52 -52
- data/spec/watirspec/elements/dd_spec.rb +124 -124
- data/spec/watirspec/elements/dds_spec.rb +42 -42
- data/spec/watirspec/elements/del_spec.rb +126 -126
- data/spec/watirspec/elements/dels_spec.rb +40 -40
- data/spec/watirspec/elements/div_spec.rb +245 -245
- data/spec/watirspec/elements/divs_spec.rb +42 -42
- data/spec/watirspec/elements/dl_spec.rb +142 -142
- data/spec/watirspec/elements/dls_spec.rb +43 -43
- data/spec/watirspec/elements/dt_spec.rb +122 -122
- data/spec/watirspec/elements/dts_spec.rb +42 -42
- data/spec/watirspec/elements/element_spec.rb +483 -483
- data/spec/watirspec/elements/elements_spec.rb +47 -47
- data/spec/watirspec/elements/em_spec.rb +96 -96
- data/spec/watirspec/elements/ems_spec.rb +43 -43
- data/spec/watirspec/elements/filefield_spec.rb +170 -170
- data/spec/watirspec/elements/filefields_spec.rb +43 -43
- data/spec/watirspec/elements/font_spec.rb +29 -29
- data/spec/watirspec/elements/form_spec.rb +66 -66
- data/spec/watirspec/elements/forms_spec.rb +46 -46
- data/spec/watirspec/elements/frame_spec.rb +123 -123
- data/spec/watirspec/elements/frames_spec.rb +41 -41
- data/spec/watirspec/elements/hidden_spec.rb +104 -104
- data/spec/watirspec/elements/hiddens_spec.rb +43 -43
- data/spec/watirspec/elements/hn_spec.rb +92 -92
- data/spec/watirspec/elements/hns_spec.rb +38 -38
- data/spec/watirspec/elements/iframe_spec.rb +10 -0
- data/spec/watirspec/elements/iframes_spec.rb +47 -47
- data/spec/watirspec/elements/image_spec.rb +158 -158
- data/spec/watirspec/elements/images_spec.rb +40 -40
- data/spec/watirspec/elements/ins_spec.rb +127 -127
- data/spec/watirspec/elements/inses_spec.rb +40 -40
- data/spec/watirspec/elements/label_spec.rb +75 -75
- data/spec/watirspec/elements/labels_spec.rb +40 -40
- data/spec/watirspec/elements/li_spec.rb +111 -111
- data/spec/watirspec/elements/link_spec.rb +171 -171
- data/spec/watirspec/elements/links_spec.rb +44 -44
- data/spec/watirspec/elements/lis_spec.rb +42 -42
- data/spec/watirspec/elements/list_spec.rb +32 -32
- data/spec/watirspec/elements/map_spec.rb +75 -75
- data/spec/watirspec/elements/maps_spec.rb +41 -41
- data/spec/watirspec/elements/meta_spec.rb +23 -23
- data/spec/watirspec/elements/metas_spec.rb +40 -40
- data/spec/watirspec/elements/ol_spec.rb +87 -87
- data/spec/watirspec/elements/ols_spec.rb +40 -40
- data/spec/watirspec/elements/option_spec.rb +121 -121
- data/spec/watirspec/elements/p_spec.rb +111 -111
- data/spec/watirspec/elements/pre_spec.rb +111 -111
- data/spec/watirspec/elements/pres_spec.rb +40 -40
- data/spec/watirspec/elements/ps_spec.rb +40 -40
- data/spec/watirspec/elements/radio_spec.rb +273 -273
- data/spec/watirspec/elements/radios_spec.rb +43 -43
- data/spec/watirspec/elements/select_list_spec.rb +553 -553
- data/spec/watirspec/elements/select_lists_spec.rb +46 -46
- data/spec/watirspec/elements/span_spec.rb +128 -128
- data/spec/watirspec/elements/spans_spec.rb +40 -40
- data/spec/watirspec/elements/strong_spec.rb +88 -88
- data/spec/watirspec/elements/strongs_spec.rb +43 -43
- data/spec/watirspec/elements/table_nesting_spec.rb +51 -51
- data/spec/watirspec/elements/table_spec.rb +156 -156
- data/spec/watirspec/elements/tables_spec.rb +42 -42
- data/spec/watirspec/elements/tbody_spec.rb +93 -93
- data/spec/watirspec/elements/tbodys_spec.rb +62 -62
- data/spec/watirspec/elements/td_spec.rb +93 -93
- data/spec/watirspec/elements/tds_spec.rb +53 -53
- data/spec/watirspec/elements/text_field_spec.rb +360 -360
- data/spec/watirspec/elements/text_fields_spec.rb +44 -44
- data/spec/watirspec/elements/textarea_spec.rb +26 -26
- data/spec/watirspec/elements/textareas_spec.rb +24 -24
- data/spec/watirspec/elements/tfoot_spec.rb +86 -86
- data/spec/watirspec/elements/tfoots_spec.rb +68 -68
- data/spec/watirspec/elements/thead_spec.rb +86 -86
- data/spec/watirspec/elements/theads_spec.rb +68 -68
- data/spec/watirspec/elements/tr_spec.rb +78 -78
- data/spec/watirspec/elements/trs_spec.rb +61 -61
- data/spec/watirspec/elements/ul_spec.rb +76 -76
- data/spec/watirspec/elements/uls_spec.rb +39 -39
- data/spec/watirspec/html/alerts.html +12 -12
- data/spec/watirspec/html/aria_attributes.html +9 -9
- data/spec/watirspec/html/class_locator.html +8 -8
- data/spec/watirspec/html/clicks.html +19 -19
- data/spec/watirspec/html/closeable.html +12 -12
- data/spec/watirspec/html/collections.html +14 -14
- data/spec/watirspec/html/css/jquery-ui-1.8.17.custom.css +286 -286
- data/spec/watirspec/html/data_attributes.html +9 -9
- data/spec/watirspec/html/definition_lists.html +47 -47
- data/spec/watirspec/html/drag_and_drop.html +106 -106
- data/spec/watirspec/html/font.html +10 -10
- data/spec/watirspec/html/forms_with_input_elements.html +174 -174
- data/spec/watirspec/html/frame_1.html +22 -22
- data/spec/watirspec/html/frame_2.html +15 -15
- data/spec/watirspec/html/frames.html +10 -10
- data/spec/watirspec/html/hover.html +11 -11
- data/spec/watirspec/html/iframe_1.html +22 -22
- data/spec/watirspec/html/iframes.html +12 -12
- data/spec/watirspec/html/images.html +27 -27
- data/spec/watirspec/html/inner_outer.html +4 -4
- data/spec/watirspec/html/javascript/angular.min.js +331 -331
- data/spec/watirspec/html/javascript/helpers.js +16 -16
- data/spec/watirspec/html/javascript/jquery-1.7.1.min.js +3 -3
- data/spec/watirspec/html/javascript/jquery-ui-1.8.17.custom.min.js +67 -67
- data/spec/watirspec/html/keylogger.html +14 -14
- data/spec/watirspec/html/modal_dialog.html +9 -9
- data/spec/watirspec/html/multiple_ids.html +14 -14
- data/spec/watirspec/html/nested_elements.html +33 -33
- data/spec/watirspec/html/nested_frame_2.html +9 -9
- data/spec/watirspec/html/nested_frame_3.html +14 -14
- data/spec/watirspec/html/nested_frames.html +10 -10
- data/spec/watirspec/html/nested_iframe_2.html +12 -12
- data/spec/watirspec/html/nested_iframes.html +13 -13
- data/spec/watirspec/html/nested_tables.html +202 -202
- data/spec/watirspec/html/non_control_elements.html +140 -140
- data/spec/watirspec/html/removed_element.html +24 -24
- data/spec/watirspec/html/right_click.html +10 -10
- data/spec/watirspec/html/special_chars.html +11 -11
- data/spec/watirspec/html/tables.html +120 -120
- data/spec/watirspec/html/timeout_window_location.html +19 -19
- data/spec/watirspec/html/uneven_table.html +20 -20
- data/spec/watirspec/html/wait.html +84 -84
- data/spec/watirspec/html/window_switching.html +11 -11
- data/spec/watirspec/radio_set_spec.rb +336 -336
- data/spec/watirspec/relaxed_locate_spec.rb +99 -99
- data/spec/watirspec/screenshot_spec.rb +29 -29
- data/spec/watirspec/support/raise_exception_matchers.rb +36 -36
- data/spec/watirspec/wait_spec.rb +381 -381
- data/spec/watirspec/window_switching_spec.rb +415 -415
- data/spec/watirspec_helper.rb +161 -161
- data/support/appveyor.cmd +9 -9
- data/support/doctest_helper.rb +101 -101
- data/support/travis.sh +11 -11
- data/support/version_differ.rb +59 -59
- data/watir.gemspec +1 -1
- metadata +4 -170
data/lib/watir/js_execution.rb
CHANGED
@@ -1,143 +1,143 @@
|
|
1
|
-
module Watir
|
2
|
-
module JSExecution
|
3
|
-
|
4
|
-
#
|
5
|
-
# Delegates script execution to Browser or IFrame.
|
6
|
-
#
|
7
|
-
def execute_script(script, *args)
|
8
|
-
@query_scope.execute_script(script, *args)
|
9
|
-
end
|
10
|
-
|
11
|
-
#
|
12
|
-
# Simulates JavaScript events on element.
|
13
|
-
# Note that you may omit "on" from event name.
|
14
|
-
#
|
15
|
-
# @example
|
16
|
-
# browser.button(name: "new_user_button").fire_event :click
|
17
|
-
# browser.button(name: "new_user_button").fire_event "mousemove"
|
18
|
-
# browser.button(name: "new_user_button").fire_event "onmouseover"
|
19
|
-
#
|
20
|
-
# @param [String, Symbol] event_name
|
21
|
-
#
|
22
|
-
|
23
|
-
def fire_event(event_name)
|
24
|
-
event_name = event_name.to_s.sub(/^on/, '').downcase
|
25
|
-
|
26
|
-
element_call { execute_js :fireEvent, @element, event_name }
|
27
|
-
end
|
28
|
-
|
29
|
-
#
|
30
|
-
# Flashes (change background color to a new color and back a few times) element.
|
31
|
-
#
|
32
|
-
# @example
|
33
|
-
# browser.li(id: 'non_link_1').flash
|
34
|
-
# browser.li(id: 'non_link_1').flash(color: "green", flashes: 3, delay: 0.05)
|
35
|
-
# browser.li(id: 'non_link_1').flash(color: "yellow")
|
36
|
-
# browser.li(id: 'non_link_1').flash(flashes: 4)
|
37
|
-
# browser.li(id: 'non_link_1').flash(delay: 0.1)
|
38
|
-
#
|
39
|
-
# @param [String] color what color to flash with
|
40
|
-
# @param [Integer] flashes number of times element should be flashed
|
41
|
-
# @param [Integer, Float] delay how long to wait between flashes
|
42
|
-
#
|
43
|
-
# @return [Watir::Element]
|
44
|
-
#
|
45
|
-
|
46
|
-
def flash(color: 'red', flashes: 5, delay: 0.2)
|
47
|
-
background_color = style("backgroundColor")
|
48
|
-
background_color = 'white' if background_color.empty?
|
49
|
-
element_color = element_call { execute_js(:backgroundColor, @element) }.strip
|
50
|
-
element_color = 'white' if element_color.empty?
|
51
|
-
|
52
|
-
(flashes * 2).times do |n|
|
53
|
-
nextcolor = n.even? ? color : background_color
|
54
|
-
element_call { execute_js(:backgroundColor, @element, nextcolor) }
|
55
|
-
sleep(delay)
|
56
|
-
end
|
57
|
-
|
58
|
-
element_call { execute_js(:backgroundColor, @element, element_color) }
|
59
|
-
|
60
|
-
self
|
61
|
-
end
|
62
|
-
|
63
|
-
#
|
64
|
-
# Focuses element.
|
65
|
-
# Note that Firefox queues focus events until the window actually has focus.
|
66
|
-
#
|
67
|
-
# @see http://code.google.com/p/selenium/issues/detail?id=157
|
68
|
-
#
|
69
|
-
|
70
|
-
def focus
|
71
|
-
element_call { execute_js(:focus, @element) }
|
72
|
-
end
|
73
|
-
|
74
|
-
#
|
75
|
-
# Returns inner HTML code of element.
|
76
|
-
#
|
77
|
-
# @example
|
78
|
-
# browser.div(id: 'shown').inner_html
|
79
|
-
# #=> "<div id=\"hidden\" style=\"display: none;\">Not shown</div><div>Not hidden</div>"
|
80
|
-
#
|
81
|
-
# @return [String]
|
82
|
-
#
|
83
|
-
|
84
|
-
def inner_html
|
85
|
-
element_call { execute_js(:getInnerHtml, @element) }.strip
|
86
|
-
end
|
87
|
-
|
88
|
-
#
|
89
|
-
# Returns inner Text code of element.
|
90
|
-
#
|
91
|
-
# @example
|
92
|
-
# browser.div(id: 'shown').inner_text
|
93
|
-
# #=> "Not hidden"
|
94
|
-
#
|
95
|
-
# @return [String]
|
96
|
-
#
|
97
|
-
|
98
|
-
def inner_text
|
99
|
-
element_call { execute_js(:getInnerText, @element) }.strip
|
100
|
-
end
|
101
|
-
|
102
|
-
#
|
103
|
-
# Returns outer (inner + element itself) HTML code of element.
|
104
|
-
#
|
105
|
-
# @example
|
106
|
-
# browser.div(id: 'shown').outer_html
|
107
|
-
# #=> "<div id=\"shown\"><div id=\"hidden\" style=\"display: none;\">Not shown</div><div>Not hidden</div></div>"
|
108
|
-
#
|
109
|
-
# @return [String]
|
110
|
-
#
|
111
|
-
|
112
|
-
def outer_html
|
113
|
-
element_call { execute_js(:getOuterHtml, @element) }.strip
|
114
|
-
end
|
115
|
-
alias_method :html, :outer_html
|
116
|
-
|
117
|
-
#
|
118
|
-
# Returns text content of element.
|
119
|
-
#
|
120
|
-
# @example
|
121
|
-
# browser.div(id: 'shown').text_content
|
122
|
-
# #=> "Not shownNot hidden"
|
123
|
-
#
|
124
|
-
# @return [String]
|
125
|
-
#
|
126
|
-
|
127
|
-
def text_content
|
128
|
-
element_call { execute_js(:getTextContent, @element) }.strip
|
129
|
-
end
|
130
|
-
|
131
|
-
#
|
132
|
-
# Selects text on page (as if dragging clicked mouse across provided text).
|
133
|
-
#
|
134
|
-
# @example
|
135
|
-
# browser.li(id: 'non_link_1').select_text('Non-link')
|
136
|
-
#
|
137
|
-
|
138
|
-
def select_text(str)
|
139
|
-
element_call { execute_js :selectText, @element, str }
|
140
|
-
end
|
141
|
-
|
142
|
-
end # JSExecution
|
143
|
-
end # Watir
|
1
|
+
module Watir
|
2
|
+
module JSExecution
|
3
|
+
|
4
|
+
#
|
5
|
+
# Delegates script execution to Browser or IFrame.
|
6
|
+
#
|
7
|
+
def execute_script(script, *args)
|
8
|
+
@query_scope.execute_script(script, *args)
|
9
|
+
end
|
10
|
+
|
11
|
+
#
|
12
|
+
# Simulates JavaScript events on element.
|
13
|
+
# Note that you may omit "on" from event name.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# browser.button(name: "new_user_button").fire_event :click
|
17
|
+
# browser.button(name: "new_user_button").fire_event "mousemove"
|
18
|
+
# browser.button(name: "new_user_button").fire_event "onmouseover"
|
19
|
+
#
|
20
|
+
# @param [String, Symbol] event_name
|
21
|
+
#
|
22
|
+
|
23
|
+
def fire_event(event_name)
|
24
|
+
event_name = event_name.to_s.sub(/^on/, '').downcase
|
25
|
+
|
26
|
+
element_call { execute_js :fireEvent, @element, event_name }
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Flashes (change background color to a new color and back a few times) element.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# browser.li(id: 'non_link_1').flash
|
34
|
+
# browser.li(id: 'non_link_1').flash(color: "green", flashes: 3, delay: 0.05)
|
35
|
+
# browser.li(id: 'non_link_1').flash(color: "yellow")
|
36
|
+
# browser.li(id: 'non_link_1').flash(flashes: 4)
|
37
|
+
# browser.li(id: 'non_link_1').flash(delay: 0.1)
|
38
|
+
#
|
39
|
+
# @param [String] color what color to flash with
|
40
|
+
# @param [Integer] flashes number of times element should be flashed
|
41
|
+
# @param [Integer, Float] delay how long to wait between flashes
|
42
|
+
#
|
43
|
+
# @return [Watir::Element]
|
44
|
+
#
|
45
|
+
|
46
|
+
def flash(color: 'red', flashes: 5, delay: 0.2)
|
47
|
+
background_color = style("backgroundColor")
|
48
|
+
background_color = 'white' if background_color.empty?
|
49
|
+
element_color = element_call { execute_js(:backgroundColor, @element) }.strip
|
50
|
+
element_color = 'white' if element_color.empty?
|
51
|
+
|
52
|
+
(flashes * 2).times do |n|
|
53
|
+
nextcolor = n.even? ? color : background_color
|
54
|
+
element_call { execute_js(:backgroundColor, @element, nextcolor) }
|
55
|
+
sleep(delay)
|
56
|
+
end
|
57
|
+
|
58
|
+
element_call { execute_js(:backgroundColor, @element, element_color) }
|
59
|
+
|
60
|
+
self
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Focuses element.
|
65
|
+
# Note that Firefox queues focus events until the window actually has focus.
|
66
|
+
#
|
67
|
+
# @see http://code.google.com/p/selenium/issues/detail?id=157
|
68
|
+
#
|
69
|
+
|
70
|
+
def focus
|
71
|
+
element_call { execute_js(:focus, @element) }
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Returns inner HTML code of element.
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# browser.div(id: 'shown').inner_html
|
79
|
+
# #=> "<div id=\"hidden\" style=\"display: none;\">Not shown</div><div>Not hidden</div>"
|
80
|
+
#
|
81
|
+
# @return [String]
|
82
|
+
#
|
83
|
+
|
84
|
+
def inner_html
|
85
|
+
element_call { execute_js(:getInnerHtml, @element) }.strip
|
86
|
+
end
|
87
|
+
|
88
|
+
#
|
89
|
+
# Returns inner Text code of element.
|
90
|
+
#
|
91
|
+
# @example
|
92
|
+
# browser.div(id: 'shown').inner_text
|
93
|
+
# #=> "Not hidden"
|
94
|
+
#
|
95
|
+
# @return [String]
|
96
|
+
#
|
97
|
+
|
98
|
+
def inner_text
|
99
|
+
element_call { execute_js(:getInnerText, @element) }.strip
|
100
|
+
end
|
101
|
+
|
102
|
+
#
|
103
|
+
# Returns outer (inner + element itself) HTML code of element.
|
104
|
+
#
|
105
|
+
# @example
|
106
|
+
# browser.div(id: 'shown').outer_html
|
107
|
+
# #=> "<div id=\"shown\"><div id=\"hidden\" style=\"display: none;\">Not shown</div><div>Not hidden</div></div>"
|
108
|
+
#
|
109
|
+
# @return [String]
|
110
|
+
#
|
111
|
+
|
112
|
+
def outer_html
|
113
|
+
element_call { execute_js(:getOuterHtml, @element) }.strip
|
114
|
+
end
|
115
|
+
alias_method :html, :outer_html
|
116
|
+
|
117
|
+
#
|
118
|
+
# Returns text content of element.
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
# browser.div(id: 'shown').text_content
|
122
|
+
# #=> "Not shownNot hidden"
|
123
|
+
#
|
124
|
+
# @return [String]
|
125
|
+
#
|
126
|
+
|
127
|
+
def text_content
|
128
|
+
element_call { execute_js(:getTextContent, @element) }.strip
|
129
|
+
end
|
130
|
+
|
131
|
+
#
|
132
|
+
# Selects text on page (as if dragging clicked mouse across provided text).
|
133
|
+
#
|
134
|
+
# @example
|
135
|
+
# browser.li(id: 'non_link_1').select_text('Non-link')
|
136
|
+
#
|
137
|
+
|
138
|
+
def select_text(str)
|
139
|
+
element_call { execute_js :selectText, @element, str }
|
140
|
+
end
|
141
|
+
|
142
|
+
end # JSExecution
|
143
|
+
end # Watir
|
data/lib/watir/js_snippets.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
module Watir
|
2
|
-
module JSSnippets
|
3
|
-
|
4
|
-
private
|
5
|
-
|
6
|
-
def execute_js(function_name, *arguments)
|
7
|
-
file = File.expand_path("../js_snippets/#{function_name}.js", __FILE__)
|
8
|
-
raise Watir::Error, "Can not excute script as #{function_name}.js does not exist" unless File.exist?(file)
|
9
|
-
|
10
|
-
js = File.read(file)
|
11
|
-
script = "return (#{js}).apply(null, arguments)"
|
12
|
-
@query_scope.execute_script(script, *arguments)
|
13
|
-
end
|
14
|
-
|
15
|
-
end # JSSnippets
|
16
|
-
end # Watir
|
1
|
+
module Watir
|
2
|
+
module JSSnippets
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
def execute_js(function_name, *arguments)
|
7
|
+
file = File.expand_path("../js_snippets/#{function_name}.js", __FILE__)
|
8
|
+
raise Watir::Error, "Can not excute script as #{function_name}.js does not exist" unless File.exist?(file)
|
9
|
+
|
10
|
+
js = File.read(file)
|
11
|
+
script = "return (#{js}).apply(null, arguments)"
|
12
|
+
@query_scope.execute_script(script, *arguments)
|
13
|
+
end
|
14
|
+
|
15
|
+
end # JSSnippets
|
16
|
+
end # Watir
|
@@ -1,7 +1,7 @@
|
|
1
|
-
function(){
|
2
|
-
if(arguments[1]) {
|
3
|
-
arguments[0].style.backgroundColor = arguments[1];
|
4
|
-
} else {
|
5
|
-
return arguments[0].style.backgroundColor;
|
6
|
-
}
|
7
|
-
}
|
1
|
+
function(){
|
2
|
+
if(arguments[1]) {
|
3
|
+
arguments[0].style.backgroundColor = arguments[1];
|
4
|
+
} else {
|
5
|
+
return arguments[0].style.backgroundColor;
|
6
|
+
}
|
7
|
+
}
|
@@ -1,31 +1,31 @@
|
|
1
|
-
// Copyright 2011 Software Freedom Conservatory
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
-
// you may not use this file except in compliance with the License.
|
4
|
-
// You may obtain a copy of the License at
|
5
|
-
//
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
7
|
-
//
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
-
// See the License for the specific language governing permissions and
|
12
|
-
// limitations under the License.
|
13
|
-
|
14
|
-
// This code was built by the Selenium code base
|
15
|
-
// See https://github.com/SeleniumHQ/selenium/tree/master/javascript/watir-atoms
|
16
|
-
|
17
|
-
function(){return function(){var l=this;
|
18
|
-
function m(a){var c=typeof a;if(c=="object")if(a){if(a instanceof Array)return"array";else if(a instanceof Object)return c;var b=Object.prototype.toString.call(a);if(b=="[object Window]")return"object";if(b=="[object Array]"||typeof a.length=="number"&&typeof a.splice!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("splice"))return"array";if(b=="[object Function]"||typeof a.call!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if(c==
|
19
|
-
"function"&&typeof a.call=="undefined")return"object";return c}function n(a,c){function b(){}b.prototype=c.prototype;a.i=c.prototype;a.prototype=new b};function o(a){this.stack=Error().stack||"";if(a)this.message=String(a)}n(o,Error);function aa(a){for(var c=1;c<arguments.length;c++){var b=String(arguments[c]).replace(/\$/g,"$$$$");a=a.replace(/\%s/,b)}return a}
|
20
|
-
function p(a,c){var b=0,d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),f=String(c).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),k=Math.max(d.length,f.length);for(var j=0;b==0&&j<k;j++){var e=d[j]||"",g=f[j]||"",q=RegExp("(\\d*)(\\D*)","g"),s=RegExp("(\\d*)(\\D*)","g");do{var h=q.exec(e)||["","",""],i=s.exec(g)||["","",""];if(h[0].length==0&&i[0].length==0)break;b=r(h[1].length==0?0:parseInt(h[1],10),i[1].length==0?0:parseInt(i[1],10))||r(h[2].length==0,i[2].length==0)||r(h[2],i[2])}while(b==
|
21
|
-
0)}return b}function r(a,c){if(a<c)return-1;else if(a>c)return 1;return 0};function t(a,c){c.unshift(a);o.call(this,aa.apply(null,c));c.shift();this.l=a}n(t,o);function ba(a,c){if(!a){var b=Array.prototype.slice.call(arguments,2),d="Assertion failed";if(c){d+=": "+c;var f=b}throw new t(""+d,f||[]);}return a};var u=Array.prototype,ca=u.indexOf?function(a,c,b){ba(a.length!=null);return u.indexOf.call(a,c,b)}:function(a,c,b){b=b==null?0:b<0?Math.max(0,a.length+b):b;if(typeof a=="string"){if(typeof c!="string"||c.length!=1)return-1;return a.indexOf(c,b)}for(b=b;b<a.length;b++)if(b in a&&a[b]===c)return b;return-1};var v,w,x,y;function z(){return l.navigator?l.navigator.userAgent:null}y=x=w=v=false;var A;if(A=z()){var da=l.navigator;v=A.indexOf("Opera")==0;w=!v&&A.indexOf("MSIE")!=-1;x=!v&&A.indexOf("WebKit")!=-1;y=!v&&!x&&da.product=="Gecko"}var B=v,C=w,D=y,E=x,F;
|
22
|
-
a:{var G="",H;if(B&&l.opera){var I=l.opera.version;G=typeof I=="function"?I():I}else{if(D)H=/rv\:([^\);]+)(\)|;)/;else if(C)H=/MSIE\s+([^\);]+)(\)|;)/;else if(E)H=/WebKit\/(\S+)/;if(H){var J=H.exec(z());G=J?J[1]:""}}if(C){var K,L=l.document;K=L?L.documentMode:undefined;if(K>parseFloat(G)){F=String(K);break a}}F=G}var M={};var ea;!C||M["9"]||(M["9"]=p(F,"9")>=0);C&&(M["9"]||(M["9"]=p(F,"9")>=0));function N(a,c){this.x=a!==undefined?a:0;this.y=c!==undefined?c:0}N.prototype.toString=function(){return"("+this.x+", "+this.y+")"};function O(a){return a?new fa(P(a)):ea||(ea=new fa)}function P(a){return a.nodeType==9?a:a.ownerDocument||a.document}function fa(a){this.e=a||l.document||document}function ga(a){a=!E&&a.e.compatMode=="CSS1Compat"?a.e.documentElement:a.e.body;return new N(a.scrollLeft,a.scrollTop)};var Q="StopIteration"in l?l.StopIteration:Error("StopIteration");function ha(){}ha.prototype.next=function(){throw Q;};function R(a,c,b,d,f){this.a=!!c;a&&S(this,a,d);this.d=f!=undefined?f:this.c||0;if(this.a)this.d*=-1;this.h=!b}n(R,ha);R.prototype.b=null;R.prototype.c=0;R.prototype.g=false;function S(a,c,b,d){if(a.b=c)a.c=typeof b=="number"?b:a.b.nodeType!=1?0:a.a?-1:1;if(typeof d=="number")a.d=d}
|
23
|
-
R.prototype.next=function(){var a;if(this.g){if(!this.b||this.h&&this.d==0)throw Q;a=this.b;var c=this.a?-1:1;if(this.c==c){var b=this.a?a.lastChild:a.firstChild;b?S(this,b):S(this,a,c*-1)}else(b=this.a?a.previousSibling:a.nextSibling)?S(this,b):S(this,a.parentNode,c*-1);this.d+=this.c*(this.a?-1:1)}else this.g=true;a=this.b;if(!this.b)throw Q;return a};
|
24
|
-
R.prototype.splice=function(){var a=this.b,c=this.a?1:-1;if(this.c==c){this.c=c*-1;this.d+=this.c*(this.a?-1:1)}this.a=!this.a;R.prototype.next.call(this);this.a=!this.a;c=arguments[0];var b=m(c);c=b=="array"||b=="object"&&typeof c.length=="number"?arguments[0]:arguments;for(b=c.length-1;b>=0;b--)a.parentNode&&a.parentNode.insertBefore(c[b],a.nextSibling);a&&a.parentNode&&a.parentNode.removeChild(a)};function T(a,c,b,d){R.call(this,a,c,b,null,d)}n(T,R);T.prototype.next=function(){do T.i.next.call(this);while(this.c==-1);return this.b};function U(a,c){var b;a:{b=P(a);if(b.defaultView&&b.defaultView.getComputedStyle)if(b=b.defaultView.getComputedStyle(a,null)){b=b[c]||b.getPropertyValue(c);break a}b=""}return b||(a.currentStyle?a.currentStyle[c]:null)||a.style[c]}function ia(a){var c=a.getBoundingClientRect();if(C){a=a.ownerDocument;c.left-=a.documentElement.clientLeft+a.body.clientLeft;c.top-=a.documentElement.clientTop+a.body.clientTop}return c}
|
25
|
-
function ja(a){if(C)return a.offsetParent;var c=P(a),b=U(a,"position"),d=b=="fixed"||b=="absolute";for(a=a.parentNode;a&&a!=c;a=a.parentNode){b=U(a,"position");d=d&&b=="static"&&a!=c.documentElement&&a!=c.body;if(!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||b=="fixed"||b=="absolute"))return a}return null};String.fromCharCode(160);var ka=C?1:0,la=["dragstart","dragexit","mouseover","mouseout"];
|
26
|
-
function V(a,c,b){var d=P(a),f=d?d.parentWindow||d.defaultView:window,k=new N;if(a.nodeType==1)if(a.getBoundingClientRect){var j=ia(a);k.x=j.left;k.y=j.top}else{j=ga(O(a));var e,g=P(a),q=U(a,"position"),s=D&&g.getBoxObjectFor&&!a.getBoundingClientRect&&q=="absolute"&&(e=g.getBoxObjectFor(a))&&(e.screenX<0||e.screenY<0),h=new N(0,0),i;e=g?g.nodeType==9?g:P(g):document;if(i=C)i=O(e).e.compatMode!="CSS1Compat";i=i?e.body:e.documentElement;if(a!=i)if(a.getBoundingClientRect){e=ia(a);g=ga(O(g));h.x=e.left+
|
27
|
-
g.x;h.y=e.top+g.y}else if(g.getBoxObjectFor&&!s){e=g.getBoxObjectFor(a);g=g.getBoxObjectFor(i);h.x=e.screenX-g.screenX;h.y=e.screenY-g.screenY}else{e=a;do{h.x+=e.offsetLeft;h.y+=e.offsetTop;if(e!=a){h.x+=e.clientLeft||0;h.y+=e.clientTop||0}if(E&&U(e,"position")=="fixed"){h.x+=g.body.scrollLeft;h.y+=g.body.scrollTop;break}e=e.offsetParent}while(e&&e!=a);if(B||E&&q=="absolute")h.y-=g.body.offsetTop;for(e=a;(e=ja(e))&&e!=g.body&&e!=i;){h.x-=e.scrollLeft;if(!B||e.tagName!="TR")h.y-=e.scrollTop}}k.x=h.x-
|
28
|
-
j.x;k.y=h.y-j.y}else{j=m(a.f)=="function";h=a;if(a.targetTouches)h=a.targetTouches[0];else if(j&&a.f().targetTouches)h=a.f().targetTouches[0];k.x=h.clientX;k.y=h.clientY}i=b||{};b=(i.x||0)+k.x;k=(i.y||0)+k.y;j=i.button||ka;h=i.bubble||true;g=null;if(ca(la,c)>=0)g=i.related||null;q=!!i.alt;e=!!i.control;s=!!i.shift;i=!!i.meta;if(a.fireEvent&&d&&d.createEventObject){a=d.createEventObject();a.altKey=q;a.j=e;a.metaKey=i;a.shiftKey=s;a.clientX=b;a.clientY=k;a.button=j;a.relatedTarget=g}else{a=d.createEvent("MouseEvents");
|
29
|
-
if(a.initMouseEvent)a.initMouseEvent(c,h,true,f,1,0,0,b,k,e,q,s,i,j,g);else{a.initEvent(c,h,true);a.shiftKey=s;a.metaKey=i;a.altKey=q;a.ctrlKey=e;a.button=j}}return a}
|
30
|
-
function W(a,c,b){var d=P(a);a=d?d.parentWindow||d.defaultView:window;var f=b||{};b=f.keyCode||0;var k=f.charCode||0,j=!!f.alt,e=!!f.ctrl,g=!!f.shift;f=!!f.meta;if(D){d=d.createEvent("KeyboardEvent");d.initKeyEvent(c,true,true,a,e,j,g,f,b,k)}else{if(C)d=d.createEventObject();else{d=d.createEvent("Events");d.initEvent(c,true,true);d.charCode=k}d.keyCode=b;d.altKey=j;d.ctrlKey=e;d.metaKey=f;d.shiftKey=g}return d}
|
31
|
-
function ma(a,c,b){var d=P(a),f=b||{};b=f.bubble!==false;var k=!!f.alt,j=!!f.control,e=!!f.shift;f=!!f.meta;if(a.fireEvent&&d&&d.createEventObject){a=d.createEventObject();a.altKey=k;a.k=j;a.metaKey=f;a.shiftKey=e}else{a=d.createEvent("HTMLEvents");a.initEvent(c,b,true);a.shiftKey=e;a.metaKey=f;a.altKey=k;a.ctrlKey=j}return a}var X={};X.click=V;X.keydown=W;X.keypress=W;X.keyup=W;X.mousedown=V;X.mousemove=V;X.mouseout=V;X.mouseover=V;X.mouseup=V;function na(a,c,b){b=(X[c]||ma)(a,c,b);var d;if(!(d=m(a.fireEvent)=="function")){d=m(a.fireEvent);d=d=="object"||d=="array"||d=="function"}if(d){try{(P(a)?P(a).parentWindow||P(a).defaultView:window).event=b}catch(f){}a=a.fireEvent("on"+c,b)}else a=a.dispatchEvent(b);return a}var Y="_".split("."),Z=l;!(Y[0]in Z)&&Z.execScript&&Z.execScript("var "+Y[0]);for(var $;Y.length&&($=Y.shift());)if(!Y.length&&na!==undefined)Z[$]=na;else Z=Z[$]?Z[$]:Z[$]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
|
1
|
+
// Copyright 2011 Software Freedom Conservatory
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
// you may not use this file except in compliance with the License.
|
4
|
+
// You may obtain a copy of the License at
|
5
|
+
//
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
//
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
// See the License for the specific language governing permissions and
|
12
|
+
// limitations under the License.
|
13
|
+
|
14
|
+
// This code was built by the Selenium code base
|
15
|
+
// See https://github.com/SeleniumHQ/selenium/tree/master/javascript/watir-atoms
|
16
|
+
|
17
|
+
function(){return function(){var l=this;
|
18
|
+
function m(a){var c=typeof a;if(c=="object")if(a){if(a instanceof Array)return"array";else if(a instanceof Object)return c;var b=Object.prototype.toString.call(a);if(b=="[object Window]")return"object";if(b=="[object Array]"||typeof a.length=="number"&&typeof a.splice!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("splice"))return"array";if(b=="[object Function]"||typeof a.call!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if(c==
|
19
|
+
"function"&&typeof a.call=="undefined")return"object";return c}function n(a,c){function b(){}b.prototype=c.prototype;a.i=c.prototype;a.prototype=new b};function o(a){this.stack=Error().stack||"";if(a)this.message=String(a)}n(o,Error);function aa(a){for(var c=1;c<arguments.length;c++){var b=String(arguments[c]).replace(/\$/g,"$$$$");a=a.replace(/\%s/,b)}return a}
|
20
|
+
function p(a,c){var b=0,d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),f=String(c).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),k=Math.max(d.length,f.length);for(var j=0;b==0&&j<k;j++){var e=d[j]||"",g=f[j]||"",q=RegExp("(\\d*)(\\D*)","g"),s=RegExp("(\\d*)(\\D*)","g");do{var h=q.exec(e)||["","",""],i=s.exec(g)||["","",""];if(h[0].length==0&&i[0].length==0)break;b=r(h[1].length==0?0:parseInt(h[1],10),i[1].length==0?0:parseInt(i[1],10))||r(h[2].length==0,i[2].length==0)||r(h[2],i[2])}while(b==
|
21
|
+
0)}return b}function r(a,c){if(a<c)return-1;else if(a>c)return 1;return 0};function t(a,c){c.unshift(a);o.call(this,aa.apply(null,c));c.shift();this.l=a}n(t,o);function ba(a,c){if(!a){var b=Array.prototype.slice.call(arguments,2),d="Assertion failed";if(c){d+=": "+c;var f=b}throw new t(""+d,f||[]);}return a};var u=Array.prototype,ca=u.indexOf?function(a,c,b){ba(a.length!=null);return u.indexOf.call(a,c,b)}:function(a,c,b){b=b==null?0:b<0?Math.max(0,a.length+b):b;if(typeof a=="string"){if(typeof c!="string"||c.length!=1)return-1;return a.indexOf(c,b)}for(b=b;b<a.length;b++)if(b in a&&a[b]===c)return b;return-1};var v,w,x,y;function z(){return l.navigator?l.navigator.userAgent:null}y=x=w=v=false;var A;if(A=z()){var da=l.navigator;v=A.indexOf("Opera")==0;w=!v&&A.indexOf("MSIE")!=-1;x=!v&&A.indexOf("WebKit")!=-1;y=!v&&!x&&da.product=="Gecko"}var B=v,C=w,D=y,E=x,F;
|
22
|
+
a:{var G="",H;if(B&&l.opera){var I=l.opera.version;G=typeof I=="function"?I():I}else{if(D)H=/rv\:([^\);]+)(\)|;)/;else if(C)H=/MSIE\s+([^\);]+)(\)|;)/;else if(E)H=/WebKit\/(\S+)/;if(H){var J=H.exec(z());G=J?J[1]:""}}if(C){var K,L=l.document;K=L?L.documentMode:undefined;if(K>parseFloat(G)){F=String(K);break a}}F=G}var M={};var ea;!C||M["9"]||(M["9"]=p(F,"9")>=0);C&&(M["9"]||(M["9"]=p(F,"9")>=0));function N(a,c){this.x=a!==undefined?a:0;this.y=c!==undefined?c:0}N.prototype.toString=function(){return"("+this.x+", "+this.y+")"};function O(a){return a?new fa(P(a)):ea||(ea=new fa)}function P(a){return a.nodeType==9?a:a.ownerDocument||a.document}function fa(a){this.e=a||l.document||document}function ga(a){a=!E&&a.e.compatMode=="CSS1Compat"?a.e.documentElement:a.e.body;return new N(a.scrollLeft,a.scrollTop)};var Q="StopIteration"in l?l.StopIteration:Error("StopIteration");function ha(){}ha.prototype.next=function(){throw Q;};function R(a,c,b,d,f){this.a=!!c;a&&S(this,a,d);this.d=f!=undefined?f:this.c||0;if(this.a)this.d*=-1;this.h=!b}n(R,ha);R.prototype.b=null;R.prototype.c=0;R.prototype.g=false;function S(a,c,b,d){if(a.b=c)a.c=typeof b=="number"?b:a.b.nodeType!=1?0:a.a?-1:1;if(typeof d=="number")a.d=d}
|
23
|
+
R.prototype.next=function(){var a;if(this.g){if(!this.b||this.h&&this.d==0)throw Q;a=this.b;var c=this.a?-1:1;if(this.c==c){var b=this.a?a.lastChild:a.firstChild;b?S(this,b):S(this,a,c*-1)}else(b=this.a?a.previousSibling:a.nextSibling)?S(this,b):S(this,a.parentNode,c*-1);this.d+=this.c*(this.a?-1:1)}else this.g=true;a=this.b;if(!this.b)throw Q;return a};
|
24
|
+
R.prototype.splice=function(){var a=this.b,c=this.a?1:-1;if(this.c==c){this.c=c*-1;this.d+=this.c*(this.a?-1:1)}this.a=!this.a;R.prototype.next.call(this);this.a=!this.a;c=arguments[0];var b=m(c);c=b=="array"||b=="object"&&typeof c.length=="number"?arguments[0]:arguments;for(b=c.length-1;b>=0;b--)a.parentNode&&a.parentNode.insertBefore(c[b],a.nextSibling);a&&a.parentNode&&a.parentNode.removeChild(a)};function T(a,c,b,d){R.call(this,a,c,b,null,d)}n(T,R);T.prototype.next=function(){do T.i.next.call(this);while(this.c==-1);return this.b};function U(a,c){var b;a:{b=P(a);if(b.defaultView&&b.defaultView.getComputedStyle)if(b=b.defaultView.getComputedStyle(a,null)){b=b[c]||b.getPropertyValue(c);break a}b=""}return b||(a.currentStyle?a.currentStyle[c]:null)||a.style[c]}function ia(a){var c=a.getBoundingClientRect();if(C){a=a.ownerDocument;c.left-=a.documentElement.clientLeft+a.body.clientLeft;c.top-=a.documentElement.clientTop+a.body.clientTop}return c}
|
25
|
+
function ja(a){if(C)return a.offsetParent;var c=P(a),b=U(a,"position"),d=b=="fixed"||b=="absolute";for(a=a.parentNode;a&&a!=c;a=a.parentNode){b=U(a,"position");d=d&&b=="static"&&a!=c.documentElement&&a!=c.body;if(!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||b=="fixed"||b=="absolute"))return a}return null};String.fromCharCode(160);var ka=C?1:0,la=["dragstart","dragexit","mouseover","mouseout"];
|
26
|
+
function V(a,c,b){var d=P(a),f=d?d.parentWindow||d.defaultView:window,k=new N;if(a.nodeType==1)if(a.getBoundingClientRect){var j=ia(a);k.x=j.left;k.y=j.top}else{j=ga(O(a));var e,g=P(a),q=U(a,"position"),s=D&&g.getBoxObjectFor&&!a.getBoundingClientRect&&q=="absolute"&&(e=g.getBoxObjectFor(a))&&(e.screenX<0||e.screenY<0),h=new N(0,0),i;e=g?g.nodeType==9?g:P(g):document;if(i=C)i=O(e).e.compatMode!="CSS1Compat";i=i?e.body:e.documentElement;if(a!=i)if(a.getBoundingClientRect){e=ia(a);g=ga(O(g));h.x=e.left+
|
27
|
+
g.x;h.y=e.top+g.y}else if(g.getBoxObjectFor&&!s){e=g.getBoxObjectFor(a);g=g.getBoxObjectFor(i);h.x=e.screenX-g.screenX;h.y=e.screenY-g.screenY}else{e=a;do{h.x+=e.offsetLeft;h.y+=e.offsetTop;if(e!=a){h.x+=e.clientLeft||0;h.y+=e.clientTop||0}if(E&&U(e,"position")=="fixed"){h.x+=g.body.scrollLeft;h.y+=g.body.scrollTop;break}e=e.offsetParent}while(e&&e!=a);if(B||E&&q=="absolute")h.y-=g.body.offsetTop;for(e=a;(e=ja(e))&&e!=g.body&&e!=i;){h.x-=e.scrollLeft;if(!B||e.tagName!="TR")h.y-=e.scrollTop}}k.x=h.x-
|
28
|
+
j.x;k.y=h.y-j.y}else{j=m(a.f)=="function";h=a;if(a.targetTouches)h=a.targetTouches[0];else if(j&&a.f().targetTouches)h=a.f().targetTouches[0];k.x=h.clientX;k.y=h.clientY}i=b||{};b=(i.x||0)+k.x;k=(i.y||0)+k.y;j=i.button||ka;h=i.bubble||true;g=null;if(ca(la,c)>=0)g=i.related||null;q=!!i.alt;e=!!i.control;s=!!i.shift;i=!!i.meta;if(a.fireEvent&&d&&d.createEventObject){a=d.createEventObject();a.altKey=q;a.j=e;a.metaKey=i;a.shiftKey=s;a.clientX=b;a.clientY=k;a.button=j;a.relatedTarget=g}else{a=d.createEvent("MouseEvents");
|
29
|
+
if(a.initMouseEvent)a.initMouseEvent(c,h,true,f,1,0,0,b,k,e,q,s,i,j,g);else{a.initEvent(c,h,true);a.shiftKey=s;a.metaKey=i;a.altKey=q;a.ctrlKey=e;a.button=j}}return a}
|
30
|
+
function W(a,c,b){var d=P(a);a=d?d.parentWindow||d.defaultView:window;var f=b||{};b=f.keyCode||0;var k=f.charCode||0,j=!!f.alt,e=!!f.ctrl,g=!!f.shift;f=!!f.meta;if(D){d=d.createEvent("KeyboardEvent");d.initKeyEvent(c,true,true,a,e,j,g,f,b,k)}else{if(C)d=d.createEventObject();else{d=d.createEvent("Events");d.initEvent(c,true,true);d.charCode=k}d.keyCode=b;d.altKey=j;d.ctrlKey=e;d.metaKey=f;d.shiftKey=g}return d}
|
31
|
+
function ma(a,c,b){var d=P(a),f=b||{};b=f.bubble!==false;var k=!!f.alt,j=!!f.control,e=!!f.shift;f=!!f.meta;if(a.fireEvent&&d&&d.createEventObject){a=d.createEventObject();a.altKey=k;a.k=j;a.metaKey=f;a.shiftKey=e}else{a=d.createEvent("HTMLEvents");a.initEvent(c,b,true);a.shiftKey=e;a.metaKey=f;a.altKey=k;a.ctrlKey=j}return a}var X={};X.click=V;X.keydown=W;X.keypress=W;X.keyup=W;X.mousedown=V;X.mousemove=V;X.mouseout=V;X.mouseover=V;X.mouseup=V;function na(a,c,b){b=(X[c]||ma)(a,c,b);var d;if(!(d=m(a.fireEvent)=="function")){d=m(a.fireEvent);d=d=="object"||d=="array"||d=="function"}if(d){try{(P(a)?P(a).parentWindow||P(a).defaultView:window).event=b}catch(f){}a=a.fireEvent("on"+c,b)}else a=a.dispatchEvent(b);return a}var Y="_".split("."),Z=l;!(Y[0]in Z)&&Z.execScript&&Z.execScript("var "+Y[0]);for(var $;Y.length&&($=Y.shift());)if(!Y.length&&na!==undefined)Z[$]=na;else Z=Z[$]?Z[$]:Z[$]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
function(){
|
2
|
-
return arguments[0].focus();
|
3
|
-
}
|
1
|
+
function(){
|
2
|
+
return arguments[0].focus();
|
3
|
+
}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
// Copyright 2011 Software Freedom Conservatory
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
-
// you may not use this file except in compliance with the License.
|
4
|
-
// You may obtain a copy of the License at
|
5
|
-
//
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
7
|
-
//
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
-
// See the License for the specific language governing permissions and
|
12
|
-
// limitations under the License.
|
13
|
-
|
14
|
-
// This code is a modification getOuterHtml.js which was built by the Selenium code base
|
15
|
-
|
16
|
-
function(){return function(){var d=this;function e(a,b){function c(){}c.prototype=b.prototype;a.b=b.prototype;a.prototype=new c};function f(a){this.stack=Error().stack||"";if(a)this.message=String(a)}e(f,Error);function i(a){for(var b=1;b<arguments.length;b++){var c=String(arguments[b]).replace(/\$/g,"$$$$");a=a.replace(/\%s/,c)}return a}
|
17
|
-
function j(a,b){var c=0,A=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),B=String(b).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),H=Math.max(A.length,B.length);for(var l=0;c==0&&l<H;l++){var I=A[l]||"",J=B[l]||"",K=RegExp("(\\d*)(\\D*)","g"),L=RegExp("(\\d*)(\\D*)","g");do{var g=K.exec(I)||["","",""],h=L.exec(J)||["","",""];if(g[0].length==0&&h[0].length==0)break;c=k(g[1].length==0?0:parseInt(g[1],10),h[1].length==0?0:parseInt(h[1],10))||k(g[2].length==0,h[2].length==0)||k(g[2],h[2])}while(c==
|
18
|
-
0)}return c}function k(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};e(function(a,b){b.unshift(a);f.call(this,i.apply(null,b));b.shift();this.a=a},f);var m,n,o,p;function q(){return d.navigator?d.navigator.userAgent:null}p=o=n=m=false;var r;if(r=q()){var s=d.navigator;m=r.indexOf("Opera")==0;n=!m&&r.indexOf("MSIE")!=-1;o=!m&&r.indexOf("WebKit")!=-1;p=!m&&!o&&s.product=="Gecko"}var t=n,u=p,v=o,w;
|
19
|
-
a:{var x="",y;if(m&&d.opera){var z=d.opera.version;x=typeof z=="function"?z():z}else{if(u)y=/rv\:([^\);]+)(\)|;)/;else if(t)y=/MSIE\s+([^\);]+)(\)|;)/;else if(v)y=/WebKit\/(\S+)/;if(y){var C=y.exec(q());x=C?C[1]:""}}if(t){var D,E=d.document;D=E?E.documentMode:undefined;if(D>parseFloat(x)){w=String(D);break a}}w=x}var F={};!t||F["9"]||(F["9"]=j(w,"9")>=0);t&&(F["9"]||(F["9"]=j(w,"9")>=0));function G(a){if("innerHTML"in a)return a.innerHTML;else{var b=(a.nodeType==9?a:a.ownerDocument||a.document).createElement("div");b.appendChild(a.cloneNode(true));return b.innerHTML}}var M="_".split("."),N=d;!(M[0]in N)&&N.execScript&&N.execScript("var "+M[0]);for(var O;M.length&&(O=M.shift());)if(!M.length&&G!==undefined)N[O]=G;else N=N[O]?N[O]:N[O]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
|
1
|
+
// Copyright 2011 Software Freedom Conservatory
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
// you may not use this file except in compliance with the License.
|
4
|
+
// You may obtain a copy of the License at
|
5
|
+
//
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
//
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
// See the License for the specific language governing permissions and
|
12
|
+
// limitations under the License.
|
13
|
+
|
14
|
+
// This code is a modification getOuterHtml.js which was built by the Selenium code base
|
15
|
+
|
16
|
+
function(){return function(){var d=this;function e(a,b){function c(){}c.prototype=b.prototype;a.b=b.prototype;a.prototype=new c};function f(a){this.stack=Error().stack||"";if(a)this.message=String(a)}e(f,Error);function i(a){for(var b=1;b<arguments.length;b++){var c=String(arguments[b]).replace(/\$/g,"$$$$");a=a.replace(/\%s/,c)}return a}
|
17
|
+
function j(a,b){var c=0,A=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),B=String(b).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),H=Math.max(A.length,B.length);for(var l=0;c==0&&l<H;l++){var I=A[l]||"",J=B[l]||"",K=RegExp("(\\d*)(\\D*)","g"),L=RegExp("(\\d*)(\\D*)","g");do{var g=K.exec(I)||["","",""],h=L.exec(J)||["","",""];if(g[0].length==0&&h[0].length==0)break;c=k(g[1].length==0?0:parseInt(g[1],10),h[1].length==0?0:parseInt(h[1],10))||k(g[2].length==0,h[2].length==0)||k(g[2],h[2])}while(c==
|
18
|
+
0)}return c}function k(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};e(function(a,b){b.unshift(a);f.call(this,i.apply(null,b));b.shift();this.a=a},f);var m,n,o,p;function q(){return d.navigator?d.navigator.userAgent:null}p=o=n=m=false;var r;if(r=q()){var s=d.navigator;m=r.indexOf("Opera")==0;n=!m&&r.indexOf("MSIE")!=-1;o=!m&&r.indexOf("WebKit")!=-1;p=!m&&!o&&s.product=="Gecko"}var t=n,u=p,v=o,w;
|
19
|
+
a:{var x="",y;if(m&&d.opera){var z=d.opera.version;x=typeof z=="function"?z():z}else{if(u)y=/rv\:([^\);]+)(\)|;)/;else if(t)y=/MSIE\s+([^\);]+)(\)|;)/;else if(v)y=/WebKit\/(\S+)/;if(y){var C=y.exec(q());x=C?C[1]:""}}if(t){var D,E=d.document;D=E?E.documentMode:undefined;if(D>parseFloat(x)){w=String(D);break a}}w=x}var F={};!t||F["9"]||(F["9"]=j(w,"9")>=0);t&&(F["9"]||(F["9"]=j(w,"9")>=0));function G(a){if("innerHTML"in a)return a.innerHTML;else{var b=(a.nodeType==9?a:a.ownerDocument||a.document).createElement("div");b.appendChild(a.cloneNode(true));return b.innerHTML}}var M="_".split("."),N=d;!(M[0]in N)&&N.execScript&&N.execScript("var "+M[0]);for(var O;M.length&&(O=M.shift());)if(!M.length&&G!==undefined)N[O]=G;else N=N[O]?N[O]:N[O]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
// Copyright 2011 Software Freedom Conservatory
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
-
// you may not use this file except in compliance with the License.
|
4
|
-
// You may obtain a copy of the License at
|
5
|
-
//
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
7
|
-
//
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
-
// See the License for the specific language governing permissions and
|
12
|
-
// limitations under the License.
|
13
|
-
|
14
|
-
// This code is a modification getOuterHtml.js which was built by the Selenium code base
|
15
|
-
|
16
|
-
function(){return function(){var d=this;function e(a,b){function c(){}c.prototype=b.prototype;a.b=b.prototype;a.prototype=new c};function f(a){this.stack=Error().stack||"";if(a)this.message=String(a)}e(f,Error);function i(a){for(var b=1;b<arguments.length;b++){var c=String(arguments[b]).replace(/\$/g,"$$$$");a=a.replace(/\%s/,c)}return a}
|
17
|
-
function j(a,b){var c=0,A=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),B=String(b).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),H=Math.max(A.length,B.length);for(var l=0;c==0&&l<H;l++){var I=A[l]||"",J=B[l]||"",K=RegExp("(\\d*)(\\D*)","g"),L=RegExp("(\\d*)(\\D*)","g");do{var g=K.exec(I)||["","",""],h=L.exec(J)||["","",""];if(g[0].length==0&&h[0].length==0)break;c=k(g[1].length==0?0:parseInt(g[1],10),h[1].length==0?0:parseInt(h[1],10))||k(g[2].length==0,h[2].length==0)||k(g[2],h[2])}while(c==
|
18
|
-
0)}return c}function k(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};e(function(a,b){b.unshift(a);f.call(this,i.apply(null,b));b.shift();this.a=a},f);var m,n,o,p;function q(){return d.navigator?d.navigator.userAgent:null}p=o=n=m=false;var r;if(r=q()){var s=d.navigator;m=r.indexOf("Opera")==0;n=!m&&r.indexOf("MSIE")!=-1;o=!m&&r.indexOf("WebKit")!=-1;p=!m&&!o&&s.product=="Gecko"}var t=n,u=p,v=o,w;
|
19
|
-
a:{var x="",y;if(m&&d.opera){var z=d.opera.version;x=typeof z=="function"?z():z}else{if(u)y=/rv\:([^\);]+)(\)|;)/;else if(t)y=/MSIE\s+([^\);]+)(\)|;)/;else if(v)y=/WebKit\/(\S+)/;if(y){var C=y.exec(q());x=C?C[1]:""}}if(t){var D,E=d.document;D=E?E.documentMode:undefined;if(D>parseFloat(x)){w=String(D);break a}}w=x}var F={};!t||F["9"]||(F["9"]=j(w,"9")>=0);t&&(F["9"]||(F["9"]=j(w,"9")>=0));function G(a){if("innerText"in a)return a.innerText;else{var b=(a.nodeType==9?a:a.ownerDocument||a.document).createElement("div");b.appendChild(a.cloneNode(true));return b.innerText}}var M="_".split("."),N=d;!(M[0]in N)&&N.execScript&&N.execScript("var "+M[0]);for(var O;M.length&&(O=M.shift());)if(!M.length&&G!==undefined)N[O]=G;else N=N[O]?N[O]:N[O]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
|
1
|
+
// Copyright 2011 Software Freedom Conservatory
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
// you may not use this file except in compliance with the License.
|
4
|
+
// You may obtain a copy of the License at
|
5
|
+
//
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
//
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
// See the License for the specific language governing permissions and
|
12
|
+
// limitations under the License.
|
13
|
+
|
14
|
+
// This code is a modification getOuterHtml.js which was built by the Selenium code base
|
15
|
+
|
16
|
+
function(){return function(){var d=this;function e(a,b){function c(){}c.prototype=b.prototype;a.b=b.prototype;a.prototype=new c};function f(a){this.stack=Error().stack||"";if(a)this.message=String(a)}e(f,Error);function i(a){for(var b=1;b<arguments.length;b++){var c=String(arguments[b]).replace(/\$/g,"$$$$");a=a.replace(/\%s/,c)}return a}
|
17
|
+
function j(a,b){var c=0,A=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),B=String(b).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),H=Math.max(A.length,B.length);for(var l=0;c==0&&l<H;l++){var I=A[l]||"",J=B[l]||"",K=RegExp("(\\d*)(\\D*)","g"),L=RegExp("(\\d*)(\\D*)","g");do{var g=K.exec(I)||["","",""],h=L.exec(J)||["","",""];if(g[0].length==0&&h[0].length==0)break;c=k(g[1].length==0?0:parseInt(g[1],10),h[1].length==0?0:parseInt(h[1],10))||k(g[2].length==0,h[2].length==0)||k(g[2],h[2])}while(c==
|
18
|
+
0)}return c}function k(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};e(function(a,b){b.unshift(a);f.call(this,i.apply(null,b));b.shift();this.a=a},f);var m,n,o,p;function q(){return d.navigator?d.navigator.userAgent:null}p=o=n=m=false;var r;if(r=q()){var s=d.navigator;m=r.indexOf("Opera")==0;n=!m&&r.indexOf("MSIE")!=-1;o=!m&&r.indexOf("WebKit")!=-1;p=!m&&!o&&s.product=="Gecko"}var t=n,u=p,v=o,w;
|
19
|
+
a:{var x="",y;if(m&&d.opera){var z=d.opera.version;x=typeof z=="function"?z():z}else{if(u)y=/rv\:([^\);]+)(\)|;)/;else if(t)y=/MSIE\s+([^\);]+)(\)|;)/;else if(v)y=/WebKit\/(\S+)/;if(y){var C=y.exec(q());x=C?C[1]:""}}if(t){var D,E=d.document;D=E?E.documentMode:undefined;if(D>parseFloat(x)){w=String(D);break a}}w=x}var F={};!t||F["9"]||(F["9"]=j(w,"9")>=0);t&&(F["9"]||(F["9"]=j(w,"9")>=0));function G(a){if("innerText"in a)return a.innerText;else{var b=(a.nodeType==9?a:a.ownerDocument||a.document).createElement("div");b.appendChild(a.cloneNode(true));return b.innerText}}var M="_".split("."),N=d;!(M[0]in N)&&N.execScript&&N.execScript("var "+M[0]);for(var O;M.length&&(O=M.shift());)if(!M.length&&G!==undefined)N[O]=G;else N=N[O]?N[O]:N[O]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
|