operawatir 0.4-jruby → 0.4.1-jruby
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitmodules +3 -3
- data/AUTHORS +1 -0
- data/CHANGES +454 -0
- data/README.md +67 -50
- data/Rakefile +6 -10
- data/VERSION +1 -1
- data/bin/desktopwatir +52 -29
- data/bin/operawatir +50 -18
- data/lib/operadriver/client-combined-nodeps.jar +0 -0
- data/lib/operadriver/webdriver-opera.jar +0 -0
- data/lib/operawatir.rb +8 -1
- data/lib/operawatir/browser.rb +35 -15
- data/lib/operawatir/collection.rb +2 -2
- data/lib/operawatir/compat.rb +3 -2
- data/lib/operawatir/compat/browser.rb +0 -5
- data/lib/operawatir/compat/collection.rb +15 -0
- data/lib/operawatir/compat/element.rb +72 -21
- data/lib/operawatir/compat/element_finders.rb +6 -0
- data/lib/operawatir/compat/selector.rb +7 -0
- data/lib/operawatir/compat/window.rb +49 -0
- data/lib/operawatir/desktop_browser.rb +88 -14
- data/lib/operawatir/desktop_common.rb +0 -2
- data/lib/operawatir/desktop_container.rb +82 -29
- data/lib/operawatir/desktop_helper.rb +2 -0
- data/lib/operawatir/element.rb +49 -25
- data/lib/operawatir/helper.rb +5 -3
- data/lib/operawatir/keys.rb +19 -6
- data/lib/operawatir/preferences.rb +315 -78
- data/lib/operawatir/quickwidgets.rb +2 -1
- data/lib/operawatir/quickwidgets/quick_addressfield.rb +12 -0
- data/lib/operawatir/quickwidgets/quick_button.rb +8 -2
- data/lib/operawatir/quickwidgets/quick_checkbox.rb +5 -5
- data/lib/operawatir/quickwidgets/quick_editfield.rb +8 -5
- data/lib/operawatir/quickwidgets/quick_find.rb +11 -0
- data/lib/operawatir/quickwidgets/quick_griditem.rb +11 -0
- data/lib/operawatir/quickwidgets/quick_gridlayout.rb +11 -0
- data/lib/operawatir/quickwidgets/quick_searchfield.rb +7 -1
- data/lib/operawatir/quickwidgets/quick_tab.rb +0 -1
- data/lib/operawatir/quickwidgets/quick_treeitem.rb +22 -1
- data/lib/operawatir/quickwidgets/quick_widget.rb +62 -23
- data/lib/operawatir/quickwidgets/quick_window.rb +32 -2
- data/lib/operawatir/screenshot.rb +46 -0
- data/lib/operawatir/version.rb +6 -4
- data/lib/operawatir/window.rb +53 -67
- data/operawatir.gemspec +310 -245
- data/spec/operawatir/README.md +4 -0
- data/spec/operawatir/core/browser_spec.rb +82 -0
- data/spec/operawatir/core/element_spec.rb +88 -0
- data/spec/operawatir/core/preferences_spec.rb +438 -0
- data/spec/operawatir/core/screenshot_spec.rb +76 -0
- data/spec/{new_watirspec → operawatir/core}/spatnav_spec.rb +3 -3
- data/spec/operawatir/core/window_spec.rb +76 -0
- data/spec/operawatir/desktop/desktopbrowser_spec.rb +316 -0
- data/spec/operawatir/desktop/quickaddressfield_spec.rb +59 -0
- data/spec/operawatir/desktop/quickbutton_spec.rb +248 -0
- data/spec/operawatir/desktop/quickcheckbox_spec.rb +36 -0
- data/spec/operawatir/desktop/quickdialogtab_spec.rb +30 -0
- data/spec/operawatir/desktop/quickdropdown_spec.rb +39 -0
- data/spec/operawatir/desktop/quickeditfield_spec.rb +51 -0
- data/spec/operawatir/desktop/quickfind_spec.rb +30 -0
- data/spec/operawatir/desktop/quickgriditem_spec.rb +16 -0
- data/spec/operawatir/desktop/quickgridlayout_spec.rb +15 -0
- data/spec/operawatir/desktop/quicklabel_spec.rb +28 -0
- data/spec/operawatir/desktop/quickradiobutton_spec.rb +24 -0
- data/spec/operawatir/desktop/quicksearchfield_spec.rb +26 -0
- data/spec/operawatir/desktop/quicktab_spec.rb +86 -0
- data/spec/operawatir/desktop/quickthumbnail_spec.rb +37 -0
- data/spec/operawatir/desktop/quicktreeitem_spec.rb +135 -0
- data/spec/operawatir/desktop/quicktreeview_spec.rb +30 -0
- data/spec/operawatir/desktop/quickwidget_spec.rb +101 -0
- data/spec/operawatir/desktop/quickwindow_spec.rb +108 -0
- data/spec/operawatir/desktop/shared/shared.rb +138 -0
- data/spec/operawatir/fixtures/boxes.html +22 -0
- data/spec/operawatir/fixtures/browsers.svg +367 -0
- data/spec/operawatir/fixtures/frames.html +13 -0
- data/spec/operawatir/fixtures/grid.html +29 -0
- data/spec/operawatir/fixtures/input_fields_value.html +6 -0
- data/spec/operawatir/fixtures/onclick.html +20 -0
- data/spec/operawatir/fixtures/paragraphs.html +15 -0
- data/spec/operawatir/fixtures/two_input_fields.html +6 -0
- data/spec/{new_watirspec → operawatir}/guards.rb +0 -0
- data/spec/operawatir/matchers.rb +68 -0
- data/spec/{legacy_watirspec → operawatir}/server.rb +0 -0
- data/spec/operawatir/watirspec.rake +43 -0
- data/spec/operawatir/watirspec_desktophelper.rb +14 -0
- data/spec/operawatir/watirspec_helper.rb +62 -0
- data/spec/{legacy_watirspec → watir2}/area_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/areas_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/browser_spec.rb +2 -0
- data/spec/{legacy_watirspec → watir2}/button_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/buttons_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/checkbox_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/checkboxes_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/collections_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dd_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dds_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/del_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dels_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/div_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/divs_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dl_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dls_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dt_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dts_spec.rb +0 -0
- data/spec/watir2/element_spec.rb +155 -0
- data/spec/{legacy_watirspec → watir2}/em_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ems_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/filefield_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/filefields_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/2000_spans.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/bug_duplicate_attributes.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/bug_javascript_001.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/buttons_with_duplicate_ids.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/collections.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/definition_lists.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/euc-jp_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/forms_with_input_elements.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/frame_1.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/frame_2.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/frames.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/iframes.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/1.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/2.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/3.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/button.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/circle.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/map.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/map2.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/minus.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/originaltriangle.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/plus.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/square.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/triangle.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/iso-2022-jp_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/javascript/helpers.js +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/jquery.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/latin1_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/multiple_ids.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/non_control_elements.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/parser_bug_001.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/prevent_form_submit.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/right_click.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/shift_jis_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/tables.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/timeout.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/timeout_window_location.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/tiny_mce.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/utf8_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/watirspec.css +0 -0
- data/spec/{legacy_watirspec → watir2}/form_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/forms_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/frame_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/frames_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/guards.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/hidden_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/hiddens_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/hn_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/hns_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/image_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/images_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ins_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/inses_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/label_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/labels_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/li_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/link_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/links_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/lis_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/map_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/maps_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/meta_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/metas_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ol_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ols_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/option_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/p_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/pre_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/pres_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ps_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/radio_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/radios_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/select_list_spec.rb +84 -71
- data/spec/{legacy_watirspec → watir2}/select_lists_spec.rb +0 -0
- data/spec/{new_watirspec → watir2}/server.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/span_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/spans_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/spec_helper.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/strong_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/strongs_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_bodies_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_body_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_cell_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_cells_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_footer_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_footers_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_header_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_headers_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_row_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_rows_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/tables_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/text_field_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/text_fields_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ul_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/uls_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/watir_compatibility_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/watirspec_helper.rb +0 -0
- data/spec/{new_watirspec → watir3}/browser_spec.rb +11 -21
- data/spec/{new_watirspec → watir3}/clipboard_spec.rb +2 -2
- data/spec/{new_watirspec → watir3}/collection_spec.rb +0 -0
- data/spec/{new_watirspec → watir3}/element_spec.rb +30 -12
- data/spec/watir3/guards.rb +39 -0
- data/spec/{new_watirspec → watir3}/keys_spec.rb +0 -0
- data/spec/watir3/server.rb +91 -0
- data/spec/{new_watirspec → watir3}/watirspec_helper.rb +0 -0
- data/spec/{new_watirspec → watir3}/window_spec.rb +8 -83
- metadata +315 -280
- data/lib/operadriver/selenium-common.jar +0 -0
- data/spec/legacy_watirspec/element_spec.rb +0 -86
- data/spec/new_watirspec/preferences_spec.rb +0 -144
- data/spec/new_watirspec/screenshot_spec.rb +0 -34
@@ -1,27 +1,76 @@
|
|
1
1
|
module OperaWatir
|
2
2
|
module Compat
|
3
3
|
module Window
|
4
|
+
include Deprecated
|
4
5
|
|
6
|
+
#
|
5
7
|
# Checks whether the body has the given text in it.
|
6
8
|
#
|
7
9
|
# @param [String] str Text to search for.
|
8
10
|
# @return [Boolean] true if the body contains the given text,
|
9
11
|
# false otherwise
|
12
|
+
#
|
13
|
+
|
10
14
|
def contains_text(str)
|
11
15
|
text.index(str)
|
12
16
|
end
|
13
17
|
|
18
|
+
|
19
|
+
#
|
14
20
|
# Find elements that match the given XPath.
|
15
21
|
#
|
16
22
|
# @param [String] value The XPath expression to search for.
|
17
23
|
# @return [OperaWatir::Collection] A collection of matching
|
18
24
|
# elements.
|
25
|
+
#
|
26
|
+
|
19
27
|
def elements_by_xpath(value)
|
20
28
|
find_by_xpath(value)
|
21
29
|
end
|
22
30
|
|
23
31
|
alias_method :element_by_xpath, :elements_by_xpath
|
24
32
|
|
33
|
+
|
34
|
+
#
|
35
|
+
# Opera specific
|
36
|
+
#
|
37
|
+
|
38
|
+
def get_hash
|
39
|
+
visual_hash
|
40
|
+
end
|
41
|
+
|
42
|
+
deprecated :get_hash, 'browser.visual_hash'
|
43
|
+
|
44
|
+
|
45
|
+
#
|
46
|
+
# TODO This is a relic from the old OperaWatir implementation,
|
47
|
+
# tests should be updated.
|
48
|
+
#
|
49
|
+
|
50
|
+
def frame(selector, argument)
|
51
|
+
case selector
|
52
|
+
when :name
|
53
|
+
driver.switch_to.frame(argument)
|
54
|
+
when :index
|
55
|
+
driver.switch_to.frame(argument.to_i - 1) # index starts from 1 in Watir
|
56
|
+
else
|
57
|
+
raise OperaWatir::Exceptions::NotImplementedException,
|
58
|
+
"We do not support the `#{selector}' selector yet"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def switch_to_default
|
64
|
+
driver.switch_to.default_content
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
def show_frames
|
69
|
+
frames = driver.list_frames
|
70
|
+
puts "There are #{frames.length.to_s} frames"
|
71
|
+
frames.each_with_index { |frame, i| puts "frame index: #{(i.to_i + 1).to_s} name: #{frame.to_s}" }
|
72
|
+
end
|
73
|
+
|
25
74
|
end
|
26
75
|
end
|
27
76
|
end
|
@@ -3,16 +3,19 @@ module OperaWatir
|
|
3
3
|
include DesktopContainer
|
4
4
|
include DesktopCommon
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
"
|
6
|
+
LoadActions = ["Open url in new page", "Open url in current page", "Open url in new background page",
|
7
|
+
"Open url in new window", "New private page", "Paste and go", "Paste and go background",
|
8
|
+
"Hotclick search", "Duplicate page", "Reopen page", "Back", "Forward", "Help"]
|
9
9
|
|
10
10
|
# @private
|
11
11
|
def initialize
|
12
|
-
OperaWatir.compatibility! unless OperaWatir.api >=
|
12
|
+
OperaWatir.compatibility! unless OperaWatir.api >= 3
|
13
13
|
|
14
14
|
self.driver = OperaDesktopDriver.new(self.class.opera_driver_settings)
|
15
15
|
self.active_window = OperaWatir::Window.new(self)
|
16
|
+
self.preferences = OperaWatir::Preferences.new(self)
|
17
|
+
self.keys = OperaWatir::Keys.new(self)
|
18
|
+
self.spatnav = OperaWatir::Spatnav.new(self)
|
16
19
|
end
|
17
20
|
|
18
21
|
# @private
|
@@ -20,10 +23,10 @@ module OperaWatir
|
|
20
23
|
# dialogs to autoclose in Dialog.cpp when then OnUrlChanged is fired
|
21
24
|
# after a dialog is opened
|
22
25
|
def goto(url = "")
|
23
|
-
|
26
|
+
active_window.url = url
|
24
27
|
sleep(1)
|
25
28
|
end
|
26
|
-
|
29
|
+
|
27
30
|
######################################################################
|
28
31
|
# Quits Opera
|
29
32
|
#
|
@@ -38,7 +41,7 @@ module OperaWatir
|
|
38
41
|
driver.quitOpera
|
39
42
|
driver.startOpera
|
40
43
|
end
|
41
|
-
|
44
|
+
|
42
45
|
######################################################################
|
43
46
|
# Quits the driver without exiting Opera
|
44
47
|
#
|
@@ -235,12 +238,24 @@ module OperaWatir
|
|
235
238
|
# puts quick_widget.to_s
|
236
239
|
# end
|
237
240
|
#
|
238
|
-
# @param
|
241
|
+
# @param window [String] name or [int] id of the window to retrieve the list of widgets from,
|
239
242
|
#
|
240
243
|
# @return [Array] Array of widgets retrieved from the window
|
241
244
|
#
|
242
|
-
def widgets(
|
243
|
-
|
245
|
+
def widgets(window)
|
246
|
+
|
247
|
+
# If window specifies window name, and the active window has this name
|
248
|
+
# use its id to get the widgets,
|
249
|
+
if window.is_a? String
|
250
|
+
active_win_id = driver.getActiveQuickWindowID()
|
251
|
+
active_win_name = driver.getQuickWindowName(active_win_id)
|
252
|
+
|
253
|
+
#If the active window is of same type, then grab that one, not first
|
254
|
+
if active_win_name == window #e.g. Both Document Window
|
255
|
+
window = active_win_id
|
256
|
+
end
|
257
|
+
end
|
258
|
+
driver.getQuickWidgetList(window).map do |java_widget|
|
244
259
|
case java_widget.getType
|
245
260
|
when QuickWidget::WIDGET_ENUM_MAP[:button]
|
246
261
|
QuickButton.new(self,java_widget)
|
@@ -281,8 +296,11 @@ module OperaWatir
|
|
281
296
|
end.to_a
|
282
297
|
end
|
283
298
|
|
284
|
-
|
285
|
-
#
|
299
|
+
####################################################
|
300
|
+
# Retrieves an array of all tabs (Document Windows)
|
301
|
+
#
|
302
|
+
# @return [Array] Array of windows
|
303
|
+
#
|
286
304
|
def open_pages
|
287
305
|
quick_windows.select { |win| win.name == "Document Window" }
|
288
306
|
end
|
@@ -398,6 +416,24 @@ module OperaWatir
|
|
398
416
|
def cache_preferences_path
|
399
417
|
driver.getCachePreferencesPath()
|
400
418
|
end
|
419
|
+
|
420
|
+
######################################################################
|
421
|
+
# Returns the language string corresponding to the string_id provided
|
422
|
+
#
|
423
|
+
# @param string_id the string_id to convert to the corresponding
|
424
|
+
# language string
|
425
|
+
# @param skip_ampersand if false, then leave string as is, else
|
426
|
+
# (default) remove any ampersand in string
|
427
|
+
#
|
428
|
+
#
|
429
|
+
# @example
|
430
|
+
# browser.string("D_NEW_PREFERENCES_GENERAL")
|
431
|
+
#
|
432
|
+
# @return [String] the language string corresponding to the string_id
|
433
|
+
#
|
434
|
+
def string(string_id, skip_ampersand = true)
|
435
|
+
string = driver.getString(string_id, skip_ampersand)
|
436
|
+
end
|
401
437
|
|
402
438
|
######################################################################
|
403
439
|
# Returns true if the test is running on Mac
|
@@ -525,16 +561,55 @@ module OperaWatir
|
|
525
561
|
driver.deleteOperaPrefs
|
526
562
|
end
|
527
563
|
|
564
|
+
# Set preference pref in prefs section prefs_section to value
|
565
|
+
# specified.
|
566
|
+
#
|
567
|
+
# @param [String] prefs_section The prefs section the pref belongs to
|
568
|
+
# @param [String] pref The preference to set
|
569
|
+
# @param [String] value The value to set the preference to
|
570
|
+
def set_preference(prefs_section, pref, value)
|
571
|
+
driver.setPref(prefs_section, pref, value.to_s)
|
572
|
+
end
|
573
|
+
|
574
|
+
# Get value of preference pref in prefs section prefs_section.
|
575
|
+
#
|
576
|
+
# @param [String] prefs_section The prefs section the pref belongs to
|
577
|
+
# @param [String] pref The preference to get
|
578
|
+
#
|
579
|
+
# @return [String] The value of the preference
|
580
|
+
def get_preference(prefs_section, pref)
|
581
|
+
driver.getPref(prefs_section, pref)
|
582
|
+
end
|
583
|
+
|
584
|
+
# Get default value of preference pref in prefs section
|
585
|
+
# prefs_section.
|
586
|
+
#
|
587
|
+
# @param [String] prefs_section The prefs section the pref belongs to
|
588
|
+
# @param [String] pref The preference to get
|
589
|
+
#
|
590
|
+
# @return [String] The value of the preference
|
591
|
+
def get_default_preference(prefs_section, pref)
|
592
|
+
driver.getDefaultPref(prefs_section, pref)
|
593
|
+
end
|
594
|
+
|
595
|
+
# @private
|
596
|
+
def start_opera
|
597
|
+
driver.startOpera
|
598
|
+
end
|
599
|
+
|
528
600
|
private
|
529
601
|
|
530
602
|
def self.opera_driver_settings
|
531
603
|
@opera_driver_settings ||= OperaDriverSettings.new.tap {|s|
|
532
604
|
s.setRunOperaLauncherFromOperaDriver true
|
605
|
+
s.setAutostart false if self.settings[:manual]
|
533
606
|
s.setOperaLauncherBinary self.settings[:launcher]
|
534
607
|
s.setOperaBinaryLocation self.settings[:path]
|
535
|
-
s.setOperaBinaryArguments self.settings[:args] + ' -
|
608
|
+
s.setOperaBinaryArguments self.settings[:args].to_s + ' -autotestmode'
|
536
609
|
s.setNoQuit self.settings[:no_quit]
|
537
610
|
s.setNoRestart self.settings[:no_restart]
|
611
|
+
s.setGuessOperaPath false
|
612
|
+
s.setUseOperaIdle false if !self.settings[:opera_idle]
|
538
613
|
}
|
539
614
|
end
|
540
615
|
|
@@ -550,4 +625,3 @@ private
|
|
550
625
|
end
|
551
626
|
|
552
627
|
end
|
553
|
-
|
@@ -41,14 +41,12 @@ private
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def key_down(key, *opts)
|
44
|
-
puts "keydown"
|
45
44
|
list = Java::JavaUtil::ArrayList.new
|
46
45
|
opts.each { |mod| list << KEYMODIFIER_ENUM_MAP[mod] }
|
47
46
|
driver.keyDown(key, list)
|
48
47
|
end
|
49
48
|
|
50
49
|
def key_up(key, *opts)
|
51
|
-
puts "keyup"
|
52
50
|
list = Java::JavaUtil::ArrayList.new
|
53
51
|
opts.each { |mod| list << KEYMODIFIER_ENUM_MAP[mod] }
|
54
52
|
driver.keyUp(key, list)
|
@@ -14,7 +14,12 @@ module OperaWatir
|
|
14
14
|
# @return [Object] button object if found, otherwise nil
|
15
15
|
#
|
16
16
|
def quick_button(how, what)
|
17
|
-
|
17
|
+
if how == :pos
|
18
|
+
if what.is_a? Fixnum
|
19
|
+
what = [0, what]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
QuickButton.new(self, how, what, parent_widget, window_id, :button)
|
18
23
|
end
|
19
24
|
|
20
25
|
######################################################################
|
@@ -36,7 +41,7 @@ module OperaWatir
|
|
36
41
|
what = [0, what]
|
37
42
|
end
|
38
43
|
end
|
39
|
-
QuickTab.new(self, how, what, parent_widget, window_id)
|
44
|
+
QuickTab.new(self, how, what, parent_widget, window_id, :tabbutton)
|
40
45
|
end
|
41
46
|
|
42
47
|
######################################################################
|
@@ -51,7 +56,7 @@ module OperaWatir
|
|
51
56
|
# @return [Object] checkbox object if found, otherwise nil
|
52
57
|
#
|
53
58
|
def quick_checkbox(how, what)
|
54
|
-
QuickCheckbox.new(self, how, what, parent_widget, window_id)
|
59
|
+
QuickCheckbox.new(self, how, what, parent_widget, window_id, :checkbox)
|
55
60
|
end
|
56
61
|
|
57
62
|
######################################################################
|
@@ -66,7 +71,7 @@ module OperaWatir
|
|
66
71
|
# @return [Object] dialog tab object if found, otherwise nil
|
67
72
|
#
|
68
73
|
def quick_dialogtab(how, what)
|
69
|
-
QuickDialogTab.new(self, how, what, parent_widget, window_id)
|
74
|
+
QuickDialogTab.new(self, how, what, parent_widget, window_id, :dialogtab)
|
70
75
|
end
|
71
76
|
|
72
77
|
######################################################################
|
@@ -81,10 +86,24 @@ module OperaWatir
|
|
81
86
|
# @return [Object] drop down object if found, otherwise nil
|
82
87
|
#
|
83
88
|
def quick_dropdown(how, what)
|
84
|
-
QuickDropdown.new(self, how, what, parent_widget, window_id)
|
89
|
+
QuickDropdown.new(self, how, what, parent_widget, window_id, :dropdown)
|
85
90
|
end
|
86
91
|
|
87
|
-
|
92
|
+
######################################################################
|
93
|
+
# Method for accessing a quickfind element
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# browser.quick_find(:name, "Filetypes_quickfind")
|
97
|
+
#
|
98
|
+
# @param [String] how Method to find the element. :name, :string_id or :text
|
99
|
+
# @param [String] what Search text to find the element with.
|
100
|
+
#
|
101
|
+
# @return [Object] quickfind object if found, otherwise nil
|
102
|
+
#
|
103
|
+
def quick_find(how, what)
|
104
|
+
QuickFind.new(self, how, what, parent_widget, window_id, :quickfind)
|
105
|
+
end
|
106
|
+
|
88
107
|
######################################################################
|
89
108
|
# Method for accessing an edit or multiedit element
|
90
109
|
#
|
@@ -97,7 +116,7 @@ module OperaWatir
|
|
97
116
|
# @return [Object] edit field object if found, otherwise nil
|
98
117
|
#
|
99
118
|
def quick_editfield(how, what)
|
100
|
-
QuickEditField.new(self, how, what, parent_widget, window_id)
|
119
|
+
QuickEditField.new(self, how, what, parent_widget, window_id, :editfield)
|
101
120
|
end
|
102
121
|
|
103
122
|
######################################################################
|
@@ -112,7 +131,7 @@ module OperaWatir
|
|
112
131
|
# @return [Object] label object if found, otherwise nil
|
113
132
|
#
|
114
133
|
def quick_label(how, what)
|
115
|
-
QuickLabel.new(self, how, what, parent_widget, window_id)
|
134
|
+
QuickLabel.new(self, how, what, parent_widget, window_id, :label)
|
116
135
|
end
|
117
136
|
|
118
137
|
######################################################################
|
@@ -127,7 +146,7 @@ module OperaWatir
|
|
127
146
|
# @return [Object] radio button object if found, otherwise nil
|
128
147
|
#
|
129
148
|
def quick_radiobutton(how, what)
|
130
|
-
QuickRadioButton.new(self, how, what, parent_widget, window_id)
|
149
|
+
QuickRadioButton.new(self, how, what, parent_widget, window_id, :radiobutton)
|
131
150
|
end
|
132
151
|
|
133
152
|
######################################################################
|
@@ -142,7 +161,7 @@ module OperaWatir
|
|
142
161
|
# @return [Object] treeview object if found, otherwise nil
|
143
162
|
#
|
144
163
|
def quick_treeview(how, what)
|
145
|
-
QuickTreeView.new(self, how, what, parent_widget, window_id)
|
164
|
+
QuickTreeView.new(self, how, what, parent_widget, window_id, :treeview)
|
146
165
|
end
|
147
166
|
|
148
167
|
######################################################################
|
@@ -157,7 +176,7 @@ module OperaWatir
|
|
157
176
|
# @return [Object] addressfield object if found, otherwise nil
|
158
177
|
#
|
159
178
|
def quick_addressfield(how, what)
|
160
|
-
QuickAddressField.new(self, how, what, parent_widget, window_id)
|
179
|
+
QuickAddressField.new(self, how, what, parent_widget, window_id, :addressfield)
|
161
180
|
end
|
162
181
|
|
163
182
|
######################################################################
|
@@ -172,7 +191,7 @@ module OperaWatir
|
|
172
191
|
# @return [Object] searchfield object if found, otherwise nil
|
173
192
|
#
|
174
193
|
def quick_searchfield(how, what)
|
175
|
-
QuickSearchField.new(self, how, what, parent_widget, window_id)
|
194
|
+
QuickSearchField.new(self, how, what, parent_widget, window_id, :search)
|
176
195
|
end
|
177
196
|
|
178
197
|
######################################################################
|
@@ -187,7 +206,7 @@ module OperaWatir
|
|
187
206
|
# @return [Object] toolbar object if found, otherwise nil
|
188
207
|
#
|
189
208
|
def quick_toolbar(how, what)
|
190
|
-
QuickToolbar.new(self, how, what, parent_widget, window_id)
|
209
|
+
QuickToolbar.new(self, how, what, parent_widget, window_id, :toolbar)
|
191
210
|
end
|
192
211
|
|
193
212
|
######################################################################
|
@@ -203,29 +222,63 @@ module OperaWatir
|
|
203
222
|
# @return [Object] treeitem object if found, otherwise nil
|
204
223
|
#
|
205
224
|
def quick_treeitem(how, what)
|
206
|
-
QuickTreeItem.new(self, how, what, parent_widget, window_id)
|
225
|
+
QuickTreeItem.new(self, how, what, parent_widget, window_id, :treeitem)
|
207
226
|
end
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
227
|
+
|
228
|
+
######################################################################
|
229
|
+
# Method for accessing a grid item in a gridlayout
|
230
|
+
#
|
231
|
+
# @example (The label dialog for mail labels)
|
232
|
+
# browser.quick_gridlayout(:name, "RulesGrid").quick_griditem(:name, "GridItem0").quick_editfield(:name, "Match")
|
233
|
+
#
|
234
|
+
# @param [String] how Method to find the element. :name, :string_id or :text
|
235
|
+
# @param [String] what Search text to find the element with. Text or position
|
236
|
+
# of treeitem. Position is specified as [row, column]
|
237
|
+
#
|
238
|
+
# @return [Object] griditem object if found, otherwise nil
|
239
|
+
#
|
240
|
+
def quick_griditem(how, what)
|
241
|
+
QuickGridItem.new(self, how, what, parent_widget, window_id, :griditem)
|
242
|
+
end
|
243
|
+
|
244
|
+
######################################################################
|
245
|
+
# Method for accessing a grid layout
|
246
|
+
# (A grid layout would normally be used to specify the path to a child item in one of its cells.
|
247
|
+
#
|
248
|
+
# @example (The label dialog for mail labels)
|
249
|
+
# browser.quick_gridlayout(:name, "RulesGrid").quick_griditem(:name, "GridItem0").quick_editfield(:name, "Match")
|
250
|
+
#
|
251
|
+
# @param [String] how Method to find the element. :name, :string_id or :text
|
252
|
+
# @param [String] what Search text to find the element with. Text or position
|
253
|
+
# of treeitem. Position is specified as [row, column]
|
254
|
+
#
|
255
|
+
# @return [Object] gridlayout object if found, otherwise nil
|
256
|
+
#
|
257
|
+
def quick_gridlayout(how, what)
|
258
|
+
QuickGridLayout.new(self, how, what, parent_widget, window_id, :gridlayout)
|
259
|
+
end
|
260
|
+
|
261
|
+
|
262
|
+
######################################################################
|
263
|
+
# Method for accessing a thumbnail (speeddial, thumbnail when hovering tab groups)
|
264
|
+
#
|
265
|
+
# @example
|
266
|
+
# browser.quick_thumbnail(:name, "Thumbnail 1")
|
267
|
+
# browser.quick_thumbnail(:name, "Speed Dial 2")
|
268
|
+
#
|
269
|
+
# @param [String] how Method to find the element. :name, :string_id or :text
|
270
|
+
# @param [String] what Search text to find the element with. Text or position
|
271
|
+
# of treeitem. Position is specified as [row, column]
|
272
|
+
#
|
273
|
+
# @return [Object] thumbnail object if found, otherwise nil
|
274
|
+
#
|
222
275
|
def quick_thumbnail(how, what)
|
223
276
|
if how == :pos
|
224
277
|
if what.is_a? Fixnum
|
225
278
|
what = [0, what]
|
226
279
|
end
|
227
280
|
end
|
228
|
-
QuickThumbnail.new(self, how, what, parent_widget, window_id)
|
281
|
+
QuickThumbnail.new(self, how, what, parent_widget, window_id, :thumbnail)
|
229
282
|
end
|
230
283
|
|
231
284
|
######################################################################
|