operawatir 0.4.3.pre1-jruby → 0.5-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +1 -1
- data/CHANGES +230 -0
- data/Gemfile +4 -0
- data/Rakefile +3 -2
- data/VERSION +1 -1
- data/bin/desktopwatir +1 -1
- data/bin/operawatir +16 -4
- data/lib/operadriver/guava-r09.jar +0 -0
- data/lib/operadriver/operadriver-v0.7.2.jar +0 -0
- data/lib/operadriver/selenium-nodeps-20100909.jar +0 -0
- data/lib/operawatir.rb +10 -3
- data/lib/operawatir/actions.rb +111 -0
- data/lib/operawatir/browser.rb +24 -20
- data/lib/operawatir/clickable_item.rb +68 -0
- data/lib/operawatir/compat.rb +4 -4
- data/lib/operawatir/compat/collection.rb +1 -1
- data/lib/operawatir/compat/element.rb +1 -1
- data/lib/operawatir/compat/window.rb +4 -3
- data/lib/operawatir/desktop_browser.rb +299 -95
- data/lib/operawatir/desktop_common.rb +88 -23
- data/lib/operawatir/desktop_container.rb +103 -34
- data/lib/operawatir/desktop_enums.rb +4 -4
- data/lib/operawatir/desktop_exceptions.rb +2 -2
- data/lib/operawatir/desktop_helper.rb +31 -8
- data/lib/operawatir/element.rb +6 -2
- data/lib/operawatir/exceptions.rb +4 -4
- data/lib/operawatir/helper.rb +6 -6
- data/lib/operawatir/keys.rb +4 -4
- data/lib/operawatir/preferences.rb +126 -155
- data/lib/operawatir/quickwidgets.rb +3 -3
- data/lib/operawatir/quickwidgets/quick_addressfield.rb +12 -5
- data/lib/operawatir/quickwidgets/quick_button.rb +39 -53
- data/lib/operawatir/quickwidgets/quick_checkbox.rb +6 -6
- data/lib/operawatir/quickwidgets/quick_dialogtab.rb +5 -5
- data/lib/operawatir/quickwidgets/quick_dropdown.rb +28 -4
- data/lib/operawatir/quickwidgets/quick_dropdownitem.rb +46 -0
- data/lib/operawatir/quickwidgets/quick_editfield.rb +16 -13
- data/lib/operawatir/quickwidgets/quick_label.rb +1 -1
- data/lib/operawatir/quickwidgets/quick_menu.rb +155 -0
- data/lib/operawatir/quickwidgets/quick_menuitem.rb +387 -0
- data/lib/operawatir/quickwidgets/quick_searchfield.rb +7 -4
- data/lib/operawatir/quickwidgets/quick_tab.rb +23 -12
- data/lib/operawatir/quickwidgets/quick_thumbnail.rb +4 -4
- data/lib/operawatir/quickwidgets/quick_toolbar.rb +1 -1
- data/lib/operawatir/quickwidgets/quick_treeitem.rb +45 -29
- data/lib/operawatir/quickwidgets/quick_treeview.rb +2 -2
- data/lib/operawatir/quickwidgets/quick_widget.rb +267 -77
- data/lib/operawatir/quickwidgets/quick_window.rb +64 -38
- data/lib/operawatir/screenshot.rb +1 -1
- data/lib/operawatir/utils.rb +31 -0
- data/lib/operawatir/window.rb +1 -1
- data/operawatir.gemspec +38 -132
- data/spec/operawatir/core/actions_spec.rb +202 -0
- data/spec/operawatir/core/browser_spec.rb +8 -8
- data/spec/operawatir/core/element_spec.rb +11 -2
- data/spec/operawatir/core/keys_spec.rb +50 -2
- data/spec/operawatir/core/preferences_spec.rb +44 -128
- data/spec/operawatir/core/spatnav_spec.rb +16 -16
- data/spec/operawatir/core/utils_spec.rb +47 -0
- data/spec/operawatir/core/window_spec.rb +1 -1
- data/spec/operawatir/desktop/desktopbrowser_spec.rb +191 -22
- data/spec/operawatir/desktop/quickbutton_spec.rb +197 -164
- data/spec/operawatir/desktop/quickcheckbox_spec.rb +12 -12
- data/spec/operawatir/desktop/quickdialogtab_spec.rb +11 -11
- data/spec/operawatir/desktop/quickdropdown_spec.rb +25 -25
- data/spec/operawatir/desktop/quickeditfield_spec.rb +31 -31
- data/spec/operawatir/desktop/quickmenu_spec.rb +57 -0
- data/spec/operawatir/desktop/quickmenuitem_spec.rb +168 -0
- data/spec/operawatir/desktop/quicktab_spec.rb +26 -15
- data/spec/operawatir/desktop/quickthumbnail_spec.rb +18 -4
- data/spec/operawatir/desktop/quicktreeitem_spec.rb +72 -72
- data/spec/operawatir/desktop/quicktreeview_spec.rb +13 -13
- data/spec/operawatir/desktop/quickwidget_spec.rb +51 -13
- data/spec/operawatir/desktop/quickwindow_spec.rb +4 -0
- data/spec/operawatir/desktop/shared/shared.rb +25 -9
- data/spec/operawatir/fixtures/draggableLists.html +67 -0
- data/spec/operawatir/fixtures/formSelectionPage.html +46 -0
- data/spec/operawatir/fixtures/js/jquery-1.4.4.min.js +167 -0
- data/spec/operawatir/fixtures/js/jquery-ui-1.8.10.custom.min.js +782 -0
- data/spec/operawatir/fixtures/keys.html +40 -0
- data/spec/operawatir/fixtures/label_submit.html +5 -0
- data/spec/operawatir/fixtures/mouse.html +59 -0
- data/spec/operawatir/fixtures/simple.html +10 -0
- data/spec/operawatir/matchers.rb +20 -19
- data/spec/operawatir/watirspec_desktophelper.rb +51 -3
- data/spec/operawatir/watirspec_helper.rb +0 -2
- metadata +91 -220
- data/lib/operadriver/client-combined-nodeps.jar +0 -0
- data/lib/operadriver/webdriver-opera.jar +0 -0
- data/spec/watir3/browser_spec.rb +0 -190
- data/spec/watir3/clipboard_spec.rb +0 -64
- data/spec/watir3/collection_spec.rb +0 -387
- data/spec/watir3/element_spec.rb +0 -474
- data/spec/watir3/guards.rb +0 -39
- data/spec/watir3/keys_spec.rb +0 -204
- data/spec/watir3/server.rb +0 -91
- data/spec/watir3/watirspec_helper.rb +0 -62
- data/spec/watir3/window_spec.rb +0 -295
data/.gitmodules
CHANGED
data/CHANGES
CHANGED
@@ -1,3 +1,233 @@
|
|
1
|
+
v0.5 2011-09-12
|
2
|
+
|
3
|
+
[OTHER]
|
4
|
+
|
5
|
+
* Pushed final version 0.5. (andreastt)
|
6
|
+
|
7
|
+
v0.5.pre3 2011-09-09
|
8
|
+
|
9
|
+
[BUG FIXES]
|
10
|
+
|
11
|
+
* Calling #to_s on opts, fixes `desktopwatir --help`. (andreastt)
|
12
|
+
|
13
|
+
* Removing redundant -autotestmode argument sent by
|
14
|
+
OperaWatir::DesktopBrowser. (andreastt)
|
15
|
+
|
16
|
+
[OTHER]
|
17
|
+
|
18
|
+
* Upgraded to OperaDriver v0.7.2. This will fix issues with getting location
|
19
|
+
of elements in SVG documents, among other fixes. (andreastt)
|
20
|
+
|
21
|
+
* Upgraded to latest head of selenium-client-nodeps. (andreatt)
|
22
|
+
|
23
|
+
v0.5.pre2 2011-09-06
|
24
|
+
|
25
|
+
[NEW FEATURES]
|
26
|
+
|
27
|
+
* Added browser utility service as Browser#utils, implementing the following
|
28
|
+
new method calls:
|
29
|
+
|
30
|
+
Utils#core_version, returning the core version
|
31
|
+
Utils#os, returning the browser's OS
|
32
|
+
Utils#product, returning product type (desktop/core/mobile)
|
33
|
+
Utils#binary_path, returning full path to Opera binary
|
34
|
+
Utils#user_agent, returning User-Agent string
|
35
|
+
Utils#pid, returning the browser's PID if available
|
36
|
+
|
37
|
+
(andreastt)
|
38
|
+
|
39
|
+
* Implementing ability to enable verbose logging in operawatir. Added
|
40
|
+
following new command-line switches to the operawatir binary:
|
41
|
+
|
42
|
+
--debug=LEVEL (or -d for short), for specifying logging level
|
43
|
+
--log=FILE, for specifying sending the logging to a file
|
44
|
+
|
45
|
+
Available logging levels are: SEVERE (highest), WARNING, INFO, CONFIG,
|
46
|
+
FINE, FINER, FINEST (lowest), ALL. Default is INFO. See `operawatir
|
47
|
+
--help` for more information.
|
48
|
+
|
49
|
+
(andreastt)
|
50
|
+
|
51
|
+
[ENHANCEMENTS]
|
52
|
+
|
53
|
+
* Now using DesiredCapabilities from OperaDriver v0.7 instead of
|
54
|
+
OperaDriverSettings. (andreastt)
|
55
|
+
|
56
|
+
[BUG FIXES]
|
57
|
+
|
58
|
+
* initMouseEvent in Element#fire_event is now clicking clientX and clientY
|
59
|
+
instead of relying on internal driver locators. (andreastt)
|
60
|
+
|
61
|
+
* Compat::Window#show_frames now returns a string instead of writing to
|
62
|
+
STDOUT. (andreastt)
|
63
|
+
|
64
|
+
* Browser#quit was calling OperaDriver.shutdown() which is now deprecated.
|
65
|
+
Fixed by now calling OperaDriver.quit() instead. (andreastt)
|
66
|
+
|
67
|
+
* `operawatir --help` was broken, fixed by converting OptionParse object to a
|
68
|
+
String. (andreastt)
|
69
|
+
|
70
|
+
[OTHER]
|
71
|
+
|
72
|
+
* Upgraded to OperaDriver v0.7.1. (andreastt)
|
73
|
+
|
74
|
+
* Added tests for new Utils interface. (andreastt)
|
75
|
+
|
76
|
+
v0.5.pre1 2011-08-31
|
77
|
+
|
78
|
+
[API CHANGES]
|
79
|
+
|
80
|
+
* Implemented advanced user interaction API in Watir by adding a new Actions
|
81
|
+
class. This is accessible through Browser#actions. (stuartk)
|
82
|
+
|
83
|
+
* Removed Browser#close_all since this is no longer supported in WebDriver.
|
84
|
+
The alternative approach is to get all windows, then cycle through them to
|
85
|
+
close them. (andreastt)
|
86
|
+
|
87
|
+
* Added following method calls related to performing context menu clicks:
|
88
|
+
|
89
|
+
DesktopBrowser#action_with_condition
|
90
|
+
DesktopBrowser#active_quick_window_id
|
91
|
+
DesktopBrowser#close_active_menu
|
92
|
+
DesktopBrowser#close_all_menus
|
93
|
+
DesktopBrowser#close_menu
|
94
|
+
DesktopBrowser#close_menu_with_key_press
|
95
|
+
DesktopBrowser#key_press_with_condition
|
96
|
+
DesktopBrowser#open_menu_with_key_press
|
97
|
+
DesktopBrowser#open_menu_with_rightclick
|
98
|
+
DesktopBrowser#quick_menuitems
|
99
|
+
DesktopBrowser#quick_menus
|
100
|
+
DesktopBrowser#quick_tabs
|
101
|
+
DesktopBrowser::ConditionTimeout
|
102
|
+
DesktopContainer#quick_dropdownitem
|
103
|
+
DesktopContainer#quick_menu
|
104
|
+
DesktopContainer#quick_menuitem
|
105
|
+
QuickMenu (...)
|
106
|
+
QuickMenuItem (...)
|
107
|
+
|
108
|
+
(karie)
|
109
|
+
|
110
|
+
* Added following utility methods:
|
111
|
+
|
112
|
+
DesktopBrowser#desktop?
|
113
|
+
DesktopHelper#linux?
|
114
|
+
DesktopHelper#mac?
|
115
|
+
DesktopCommon#linux_internal?
|
116
|
+
DesktopCommon#mac_internal?
|
117
|
+
DesktopCommon#wait_for_menu_closed
|
118
|
+
DesktopCommon#wait_for_menu_shown
|
119
|
+
DesktopCommon#wait_for_widget_visible
|
120
|
+
DesktopCommon#widgets
|
121
|
+
|
122
|
+
(karie)
|
123
|
+
|
124
|
+
* Added QuickButton#wait_for_visible to wait for a button to become visible.
|
125
|
+
(karie)
|
126
|
+
|
127
|
+
* Added following APIs related to QuickDropdown's:
|
128
|
+
|
129
|
+
QuickDropdown#dropped_down?
|
130
|
+
QuickDropdown#open_with_click
|
131
|
+
QuickDropdownItem (...)
|
132
|
+
|
133
|
+
* Added QuickTab#close_window_with_doubleclick. (karie)
|
134
|
+
|
135
|
+
* Added following APIs related to QuickTreeItem:
|
136
|
+
|
137
|
+
QuickTreeItem#open_dialog_with_click
|
138
|
+
QuickTreeItem#open_window_with_click
|
139
|
+
|
140
|
+
(karie)
|
141
|
+
|
142
|
+
* Added following APIs related to widgets:
|
143
|
+
|
144
|
+
QuickWidget#click_with_condition
|
145
|
+
QuickWidget#click_with_condition_internal
|
146
|
+
QuickWidget#double_click_with_condition
|
147
|
+
QuickWidget#focus_with_hover
|
148
|
+
QuickWidget#middle_click_with_condition
|
149
|
+
QuickWidget#open_menu_with_rightclick
|
150
|
+
QuickWidget#open_window_with_click_internal
|
151
|
+
QuickWidget#quick_tabs
|
152
|
+
QuickWidget#quick_widgets
|
153
|
+
QuickWidget#right_click_with_condition
|
154
|
+
QuickWidget#verify_realtext
|
155
|
+
QuickWidget::ConditionTimeout
|
156
|
+
|
157
|
+
(karie)
|
158
|
+
|
159
|
+
* Added following APIs related to QuickWindow:
|
160
|
+
|
161
|
+
QuickWindow#active?
|
162
|
+
QuickWindow#quick_widgets
|
163
|
+
|
164
|
+
(karie)
|
165
|
+
|
166
|
+
* Removed DesktopBrowser#open_dialog_with_click. (karie)
|
167
|
+
|
168
|
+
* Removed DesktopBrowser#key_down. (karie)
|
169
|
+
|
170
|
+
* Removed DesktopBrowser#key_up. (karie)
|
171
|
+
|
172
|
+
* Removed Preferences::Entry (...) and Preferences::SECTIONS; replaced by
|
173
|
+
Preferences::Section and Preferences::Section::Key. (andreastt)
|
174
|
+
|
175
|
+
* Removed QuickButton#load_page_with_click. (karie)
|
176
|
+
|
177
|
+
* Removed QuickButton#open_dialog_with_click. (karie)
|
178
|
+
|
179
|
+
* Removed QuickButton#open_window_with_click. (karie)
|
180
|
+
|
181
|
+
* Exposed WebElement.middleClick() from WebDriver as Element#middle_click.
|
182
|
+
(andreastt)
|
183
|
+
|
184
|
+
* Renamed #key_down, and #key_up in desktop_browser to avoid clash with clash
|
185
|
+
with browser#key_down and up. Fixes failures of operawatir/core spec tests.
|
186
|
+
New APIs:
|
187
|
+
|
188
|
+
DesktopCommon#key_down_direct
|
189
|
+
DesktopCommon#key_up_direct
|
190
|
+
|
191
|
+
(karie)
|
192
|
+
|
193
|
+
[NEW FEATURES]
|
194
|
+
|
195
|
+
* Access to widgets in Desktop. (karie/adamm)
|
196
|
+
|
197
|
+
* Context menus in Desktop. (karie/adamm)
|
198
|
+
|
199
|
+
[BUG FIXES]
|
200
|
+
|
201
|
+
* Fix for bug DSK-341584 concerning a regression in quick_treeitem where it
|
202
|
+
complained about wrong number of arguments. (karie)
|
203
|
+
|
204
|
+
* profile-autotest folder was not deleted in running any spec test with no
|
205
|
+
arguments, fixes DSK-333674. (karie)
|
206
|
+
|
207
|
+
* Add separator to #QuickMenuItem#to_s method. (adamm)
|
208
|
+
|
209
|
+
* Fixes to make Mac work with menus and multiple windows. (adamm)
|
210
|
+
|
211
|
+
* treeitem open window with click, fixes bug DSK-341539. (karie)
|
212
|
+
|
213
|
+
[OTHER]
|
214
|
+
|
215
|
+
* Added more desktop-related tests. (karie)
|
216
|
+
|
217
|
+
* Added preliminary tests for keys implementation in key_spec.rb.
|
218
|
+
(andreastt)
|
219
|
+
|
220
|
+
* Fixes to make core tests run. (andreastt)
|
221
|
+
|
222
|
+
* Fixes to make desktop tests run. (mariap)
|
223
|
+
|
224
|
+
v0.4.3.pre2 2011-05-25
|
225
|
+
|
226
|
+
[BUG FIXES]
|
227
|
+
|
228
|
+
* Element#click and Compat::Element#click now defaults to
|
229
|
+
coordinates [1,1], fixing WTR-354. (andreastt)
|
230
|
+
|
1
231
|
v0.4.3.pre1 2011-05-24
|
2
232
|
|
3
233
|
[OTHER]
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -3,6 +3,7 @@ require 'rake/clean'
|
|
3
3
|
require 'jeweler'
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
require 'yard'
|
6
|
+
require 'ci/reporter/rake/rspec'
|
6
7
|
|
7
8
|
require './lib/operawatir/version'
|
8
9
|
|
@@ -47,8 +48,8 @@ end
|
|
47
48
|
|
48
49
|
CLEAN.add 'pkg'
|
49
50
|
|
50
|
-
RSpec::Core::RakeTask.new
|
51
|
-
|
51
|
+
RSpec::Core::RakeTask.new(:spec)
|
52
|
+
task :test => [:"ci:setup:rspec", :spec]
|
52
53
|
|
53
54
|
YARD::Rake::YardocTask.new do |t|
|
54
55
|
t.options = ['--no-private']
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5
|
data/bin/desktopwatir
CHANGED
data/bin/operawatir
CHANGED
@@ -27,7 +27,7 @@ begin
|
|
27
27
|
Usage: operawatir [-m|--manual] [-l|--launcher=BINARY] [--binary=BINARY]
|
28
28
|
[-a|--args=ARGUMENTS] [-q|--no-quit] [--opera-idle] [-b|--backtrace]
|
29
29
|
[--no-color] [-t|--tag=TAG] [-f|--format=FORMAT] [-o|--out=FILE]
|
30
|
-
[-h|--help] [-v|--version] FILES
|
30
|
+
[-d|--debug=LEVEL] [--log=FILE] [-h|--help] [-v|--version] FILES
|
31
31
|
EOS
|
32
32
|
|
33
33
|
opts.separator ''
|
@@ -90,16 +90,28 @@ EOS
|
|
90
90
|
opts.separator ''
|
91
91
|
opts.separator 'Common options:'
|
92
92
|
|
93
|
+
opts.on_tail('-d', '--debug=LEVEL', 'The logging level to use. Available levels: SEVERE',
|
94
|
+
'(highest), WARNING, INFO (default), CONFIG, FINE,',
|
95
|
+
'FINER, FINEST (lowest), ALL') do |l|
|
96
|
+
available_levels = ['SEVERE', 'WARNING', 'INFO', 'CONFIG', 'FINE', 'FINER', 'FINEST', 'ALL']
|
97
|
+
raise OptionParser::InvalidArgument, l.to_s.inspect unless available_levels.include?(l)
|
98
|
+
@options[:logging_level] = l
|
99
|
+
end
|
100
|
+
|
101
|
+
opts.on_tail('--log=FILE', 'Output the log to a file') do |f|
|
102
|
+
@options[:logging_file] = f
|
103
|
+
end
|
104
|
+
|
93
105
|
opts.on_tail('-h', '--help', 'Show this message') do
|
94
|
-
abort opts
|
106
|
+
abort opts.to_s
|
95
107
|
end
|
96
108
|
|
97
109
|
opts.on_tail('-v', '--version', 'Show version') do
|
98
110
|
abort "OperaWatir version #{OperaWatir.version}"
|
99
111
|
end
|
100
112
|
end.parse!(ARGV)
|
101
|
-
rescue OptionParser::
|
102
|
-
abort "operawatir:
|
113
|
+
rescue OptionParser::ParseError => e
|
114
|
+
abort "operawatir: #{e}"
|
103
115
|
end
|
104
116
|
|
105
117
|
if ARGV.empty?
|
Binary file
|
Binary file
|
Binary file
|
data/lib/operawatir.rb
CHANGED
@@ -4,12 +4,14 @@ require 'deprecated'
|
|
4
4
|
require 'java'
|
5
5
|
include Java
|
6
6
|
|
7
|
-
%w(commons-jxpath-1.3.jar protobuf-java-2.3.0.jar
|
8
|
-
|
7
|
+
%w(commons-jxpath-1.3.jar protobuf-java-2.3.0.jar selenium-nodeps-20100909.jar
|
8
|
+
operadriver-v0.7.2.jar commons-io-2.0.1.jar guava-r09.jar).each { |jar| require "operadriver/#{jar}" }
|
9
9
|
|
10
10
|
include_class org.openqa.selenium.WebDriver
|
11
|
-
include_class org.openqa.selenium.
|
11
|
+
include_class org.openqa.selenium.remote.RemoteWebElement
|
12
12
|
include_class org.openqa.selenium.NoSuchElementException
|
13
|
+
include_class org.openqa.selenium.interactions.Actions
|
14
|
+
include_class org.openqa.selenium.remote.DesiredCapabilities
|
13
15
|
include_class com.opera.core.systems.OperaDriver
|
14
16
|
include_class com.opera.core.systems.OperaWebElement
|
15
17
|
include_class com.opera.core.systems.settings.OperaDriverSettings
|
@@ -19,6 +21,8 @@ include_class com.opera.core.systems.OperaDesktopDriver
|
|
19
21
|
include_class com.opera.core.systems.scope.protos.DesktopWmProtos
|
20
22
|
include_class com.opera.core.systems.scope.protos.SystemInputProtos
|
21
23
|
include_class com.opera.core.systems.QuickWidget
|
24
|
+
include_class com.opera.core.systems.QuickMenu
|
25
|
+
include_class com.opera.core.systems.QuickMenuItem
|
22
26
|
|
23
27
|
$KCODE = 'u' # UTF-8 support
|
24
28
|
|
@@ -56,6 +60,8 @@ require 'operawatir/keys'
|
|
56
60
|
require 'operawatir/screenshot'
|
57
61
|
require 'operawatir/preferences'
|
58
62
|
require 'operawatir/spatnav'
|
63
|
+
require 'operawatir/actions'
|
64
|
+
require 'operawatir/utils'
|
59
65
|
|
60
66
|
require 'operawatir/exceptions'
|
61
67
|
require 'operawatir/selector'
|
@@ -69,6 +75,7 @@ require 'operawatir/compat'
|
|
69
75
|
# Desktop stuff
|
70
76
|
require 'operawatir/desktop_enums'
|
71
77
|
require 'operawatir/desktop_common'
|
78
|
+
require 'operawatir/clickable_item'
|
72
79
|
require 'operawatir/desktop_container'
|
73
80
|
require 'operawatir/desktop_browser'
|
74
81
|
require 'operawatir/quickwidgets'
|
@@ -0,0 +1,111 @@
|
|
1
|
+
include_class org.openqa.selenium.interactions.Actions
|
2
|
+
#include_class java.util.lang.CharSequence
|
3
|
+
|
4
|
+
class OperaWatir::Actions
|
5
|
+
|
6
|
+
attr_accessor :browser
|
7
|
+
attr_accessor :driver
|
8
|
+
attr_accessor :actions
|
9
|
+
|
10
|
+
def initialize(browser)
|
11
|
+
self.browser, self.driver = browser, browser.driver
|
12
|
+
self.actions = Java::OrgOpenqaSeleniumInteractions::Actions.new(@driver)
|
13
|
+
|
14
|
+
@sym_key_map = {}
|
15
|
+
end
|
16
|
+
|
17
|
+
# If only one argument is given then it is the key, and so we call the
|
18
|
+
# method that accepts only the key
|
19
|
+
def key_down(element, key = nil)
|
20
|
+
if not key
|
21
|
+
@actions.keyDown(sym_to_key(element))
|
22
|
+
else
|
23
|
+
@actions.keyDown(element.node, sym_to_key(key))
|
24
|
+
end
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
# If only one argument is given then it is the key, and so we call the
|
29
|
+
# method that accepts only the key
|
30
|
+
def key_up(element, key = nil)
|
31
|
+
if not key
|
32
|
+
@actions.keyUp(sym_to_key(element))
|
33
|
+
else
|
34
|
+
@actions.keyUp(element.node, sym_to_key(key))
|
35
|
+
end
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
39
|
+
# If only one argument is given then it is the key, and so we call the
|
40
|
+
# method that accepts only the key
|
41
|
+
def send_keys(element, keys_to_send = nil)
|
42
|
+
if not keys_to_send
|
43
|
+
@actions.sendKeys(element)
|
44
|
+
else
|
45
|
+
@actions.sendKeys(element.node, keys_to_send)
|
46
|
+
end
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
def click_and_hold(element)
|
51
|
+
@actions.clickAndHold(element.node)
|
52
|
+
self
|
53
|
+
end
|
54
|
+
|
55
|
+
def release(element)
|
56
|
+
@actions.release(element.node)
|
57
|
+
self
|
58
|
+
end
|
59
|
+
|
60
|
+
def click(element = nil)
|
61
|
+
element ? @actions.click(element.node) : @actions.click()
|
62
|
+
self
|
63
|
+
end
|
64
|
+
|
65
|
+
def double_click(element = nil)
|
66
|
+
element ? @actions.double_click(element.node) : @actions.double_click()
|
67
|
+
self
|
68
|
+
end
|
69
|
+
|
70
|
+
def move_to_element(element, x_offset = 0, y_offset = 0)
|
71
|
+
@actions.moveToElement(element.node, x_offset, y_offset)
|
72
|
+
self
|
73
|
+
end
|
74
|
+
|
75
|
+
def move_by_offset(x_offset, y_offset)
|
76
|
+
@actions.moveByOffset(x_offset, y_offset)
|
77
|
+
self
|
78
|
+
end
|
79
|
+
|
80
|
+
def context_click(element)
|
81
|
+
@actions.contextClick(element.node)
|
82
|
+
self
|
83
|
+
end
|
84
|
+
|
85
|
+
def drag_and_drop(source, target)
|
86
|
+
@actions.dragAndDrop(source.node, target.node)
|
87
|
+
self
|
88
|
+
end
|
89
|
+
|
90
|
+
def drag_and_drop_by(source, x_offset, y_offset)
|
91
|
+
@actions.dragAndDrop(source, x_offset, y_offset)
|
92
|
+
self
|
93
|
+
end
|
94
|
+
|
95
|
+
def perform()
|
96
|
+
@actions.perform()
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
100
|
+
|
101
|
+
def sym_to_key(sym)
|
102
|
+
if @sym_key_map.empty?
|
103
|
+
Java::OrgOpenqaSelenium::Keys.values().each do |k|
|
104
|
+
@sym_key_map[k.name().downcase.to_sym] = k
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
@sym_key_map[sym]
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|