selenium-webdriver 3.0.0.beta4.0 → 4.0.0.alpha5
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.
- checksums.yaml +7 -0
- data/CHANGES +679 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lib/selenium-webdriver.rb +2 -2
- data/lib/selenium/server.rb +23 -16
- data/lib/selenium/webdriver.rb +43 -25
- data/lib/selenium/webdriver/atoms.rb +20 -1
- data/lib/selenium/webdriver/atoms/findElements.js +122 -0
- data/lib/selenium/webdriver/atoms/getAttribute.js +84 -11
- data/lib/selenium/webdriver/atoms/isDisplayed.js +100 -0
- data/lib/selenium/webdriver/chrome.rb +15 -20
- data/lib/selenium/webdriver/chrome/bridge.rb +29 -66
- data/lib/selenium/webdriver/{edge/service.rb → chrome/driver.rb} +19 -22
- data/lib/selenium/webdriver/chrome/options.rb +221 -0
- data/lib/selenium/webdriver/chrome/profile.rb +6 -7
- data/lib/selenium/webdriver/chrome/service.rb +20 -20
- data/lib/selenium/webdriver/common.rb +19 -11
- data/lib/selenium/webdriver/common/action_builder.rb +98 -246
- data/lib/selenium/webdriver/common/alert.rb +2 -7
- data/lib/selenium/webdriver/common/driver.rb +89 -51
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +45 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +50 -0
- data/lib/selenium/webdriver/common/driver_extensions/{has_input_devices.rb → has_debugger.rb} +12 -25
- data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +38 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -3
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -2
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +4 -4
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +9 -3
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -5
- data/lib/selenium/webdriver/common/element.rb +32 -10
- data/lib/selenium/webdriver/common/error.rb +103 -121
- data/lib/selenium/webdriver/common/file_reaper.rb +3 -5
- data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -2
- data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -2
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +3 -2
- data/lib/selenium/webdriver/common/interactions/input_device.rb +54 -0
- data/lib/selenium/webdriver/common/interactions/interaction.rb +53 -0
- data/lib/selenium/webdriver/{phantomjs.rb → common/interactions/interactions.rb} +17 -20
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +145 -0
- data/lib/selenium/webdriver/common/interactions/key_input.rb +66 -0
- data/lib/selenium/webdriver/common/interactions/none_input.rb +36 -0
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +363 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +139 -0
- data/lib/selenium/webdriver/common/keys.rb +37 -15
- data/lib/selenium/webdriver/common/log_entry.rb +4 -4
- data/lib/selenium/webdriver/common/logger.rb +147 -0
- data/lib/selenium/webdriver/common/logs.rb +2 -2
- data/lib/selenium/webdriver/common/manager.rb +177 -0
- data/lib/selenium/webdriver/common/navigation.rb +2 -2
- data/lib/selenium/webdriver/common/options.rb +47 -105
- data/lib/selenium/webdriver/common/platform.rb +44 -38
- data/lib/selenium/webdriver/common/port_prober.rb +8 -19
- data/lib/selenium/webdriver/common/profile_helper.rb +13 -5
- data/lib/selenium/webdriver/common/proxy.rb +14 -8
- data/lib/selenium/webdriver/common/search_context.rb +16 -20
- data/lib/selenium/webdriver/common/service.rb +115 -30
- data/lib/selenium/webdriver/common/socket_lock.rb +12 -7
- data/lib/selenium/webdriver/common/socket_poller.rb +29 -22
- data/lib/selenium/webdriver/common/target_locator.rb +6 -6
- data/lib/selenium/webdriver/common/timeouts.rb +2 -2
- data/lib/selenium/webdriver/common/wait.rb +14 -8
- data/lib/selenium/webdriver/common/window.rb +38 -2
- data/lib/selenium/webdriver/common/zipper.rb +3 -5
- data/lib/selenium/webdriver/edge.rb +33 -20
- data/lib/selenium/webdriver/edge_chrome/bridge.rb +30 -0
- data/lib/selenium/webdriver/edge_chrome/driver.rb +38 -0
- data/lib/selenium/webdriver/{common/driver_extensions/has_touch_screen.rb → edge_chrome/options.rb} +10 -12
- data/lib/selenium/webdriver/edge_chrome/profile.rb +33 -0
- data/lib/selenium/webdriver/edge_chrome/service.rb +36 -0
- data/lib/selenium/webdriver/edge_html/driver.rb +39 -0
- data/lib/selenium/webdriver/edge_html/options.rb +91 -0
- data/lib/selenium/webdriver/edge_html/service.rb +47 -0
- data/lib/selenium/webdriver/firefox.rb +24 -29
- data/lib/selenium/webdriver/firefox/bridge.rb +15 -39
- data/lib/selenium/webdriver/firefox/{util.rb → driver.rb} +13 -19
- data/lib/selenium/webdriver/firefox/extension.rb +28 -8
- data/lib/selenium/webdriver/firefox/options.rb +162 -0
- data/lib/selenium/webdriver/firefox/profile.rb +23 -82
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +5 -5
- data/lib/selenium/webdriver/firefox/service.rb +18 -37
- data/lib/selenium/webdriver/ie.rb +13 -19
- data/lib/selenium/webdriver/ie/driver.rb +40 -0
- data/lib/selenium/webdriver/ie/options.rb +118 -0
- data/lib/selenium/webdriver/ie/service.rb +20 -20
- data/lib/selenium/webdriver/remote.rb +15 -17
- data/lib/selenium/webdriver/remote/bridge.rb +281 -300
- data/lib/selenium/webdriver/remote/capabilities.rb +102 -83
- data/lib/selenium/webdriver/remote/commands.rb +132 -192
- data/lib/selenium/webdriver/remote/driver.rb +52 -0
- data/lib/selenium/webdriver/remote/http/common.rb +23 -13
- data/lib/selenium/webdriver/remote/http/curb.rb +10 -7
- data/lib/selenium/webdriver/remote/http/default.rb +52 -32
- data/lib/selenium/webdriver/remote/http/persistent.rb +8 -4
- data/lib/selenium/webdriver/remote/response.rb +32 -35
- data/lib/selenium/webdriver/remote/server_error.rb +2 -2
- data/lib/selenium/webdriver/safari.rb +24 -22
- data/lib/selenium/webdriver/safari/bridge.rb +21 -21
- data/lib/selenium/webdriver/safari/driver.rb +41 -0
- data/lib/selenium/webdriver/safari/options.rb +66 -0
- data/lib/selenium/webdriver/safari/service.rb +8 -24
- data/lib/selenium/webdriver/support.rb +3 -2
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -2
- data/lib/selenium/webdriver/support/block_event_listener.rb +3 -3
- data/lib/selenium/webdriver/support/color.rb +13 -13
- data/lib/selenium/webdriver/support/escaper.rb +2 -2
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
- data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
- data/lib/selenium/webdriver/support/select.rb +20 -21
- data/lib/selenium/webdriver/version.rb +24 -0
- data/selenium-webdriver.gemspec +31 -17
- metadata +331 -248
- data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
- data/lib/selenium/webdriver/common/keyboard.rb +0 -69
- data/lib/selenium/webdriver/common/mouse.rb +0 -88
- data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -81
- data/lib/selenium/webdriver/common/touch_screen.rb +0 -121
- data/lib/selenium/webdriver/common/w3c_error.rb +0 -191
- data/lib/selenium/webdriver/edge/bridge.rb +0 -76
- data/lib/selenium/webdriver/edge/legacy_support.rb +0 -117
- data/lib/selenium/webdriver/firefox/binary.rb +0 -186
- data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +0 -114
- data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/firefox/w3c_bridge.rb +0 -79
- data/lib/selenium/webdriver/ie/bridge.rb +0 -76
- data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -65
- data/lib/selenium/webdriver/phantomjs/service.rb +0 -66
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -682
- data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -228
- data/lib/selenium/webdriver/remote/w3c_commands.rb +0 -135
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
#
|
|
23
|
-
# Shared across bridges
|
|
24
|
-
#
|
|
25
|
-
# @api private
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
module BridgeHelper
|
|
29
|
-
def unwrap_script_result(arg)
|
|
30
|
-
case arg
|
|
31
|
-
when Array
|
|
32
|
-
arg.map { |e| unwrap_script_result(e) }
|
|
33
|
-
when Hash
|
|
34
|
-
element_id = element_id_from(arg)
|
|
35
|
-
element_id = arg if self.is_a?(Remote::W3CBridge) && element_id
|
|
36
|
-
return Element.new(self, element_id) if element_id
|
|
37
|
-
arg.each { |k, v| arg[k] = unwrap_script_result(v) }
|
|
38
|
-
else
|
|
39
|
-
arg
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def element_id_from(id)
|
|
44
|
-
id['ELEMENT'] || id['element-6066-11e4-a52e-4f735466cecf']
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def parse_cookie_string(str)
|
|
48
|
-
result = {
|
|
49
|
-
'name' => '',
|
|
50
|
-
'value' => '',
|
|
51
|
-
'domain' => '',
|
|
52
|
-
'path' => '',
|
|
53
|
-
'expires' => '',
|
|
54
|
-
'secure' => false
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
str.split(';').each do |attribute|
|
|
58
|
-
if attribute.include? '='
|
|
59
|
-
key, value = attribute.strip.split('=', 2)
|
|
60
|
-
if result['name'].empty?
|
|
61
|
-
result['name'] = key
|
|
62
|
-
result['value'] = value
|
|
63
|
-
elsif key == 'domain' && value.strip =~ /^\.(.+)/
|
|
64
|
-
result['domain'] = Regexp.last_match(1)
|
|
65
|
-
elsif key && value
|
|
66
|
-
result[key] = value
|
|
67
|
-
end
|
|
68
|
-
elsif attribute == 'secure'
|
|
69
|
-
result['secure'] = true
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
unless [nil, '', '0'].include?(result['expires'])
|
|
73
|
-
# firefox stores expiry as number of seconds
|
|
74
|
-
result['expires'] = Time.at(result['expires'].to_i)
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
result
|
|
79
|
-
end
|
|
80
|
-
end # BridgeHelper
|
|
81
|
-
end # WebDriver
|
|
82
|
-
end # Selenium
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
#
|
|
23
|
-
# @api private
|
|
24
|
-
# @see ActionBuilder
|
|
25
|
-
|
|
26
|
-
class Keyboard
|
|
27
|
-
def initialize(bridge)
|
|
28
|
-
@bridge = bridge
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def send_keys(*keys)
|
|
32
|
-
@bridge.send_keys_to_active_element Keys.encode(keys)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
# Press a modifier key
|
|
37
|
-
#
|
|
38
|
-
# @see Selenium::WebDriver::Keys
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
def press(key)
|
|
42
|
-
assert_modifier key
|
|
43
|
-
|
|
44
|
-
@bridge.send_keys_to_active_element Keys.encode([key])
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
#
|
|
48
|
-
# Release a modifier key
|
|
49
|
-
#
|
|
50
|
-
# @see Selenium::WebDriver::Keys
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
def release(key)
|
|
54
|
-
assert_modifier key
|
|
55
|
-
|
|
56
|
-
@bridge.send_keys_to_active_element Keys.encode([key])
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
private
|
|
60
|
-
|
|
61
|
-
MODIFIERS = [:control, :shift, :alt, :command, :meta].freeze
|
|
62
|
-
|
|
63
|
-
def assert_modifier(key)
|
|
64
|
-
return if MODIFIERS.include? key
|
|
65
|
-
raise ArgumentError, "#{key.inspect} is not a modifier key, expected one of #{MODIFIERS.inspect}"
|
|
66
|
-
end
|
|
67
|
-
end # Keyboard
|
|
68
|
-
end # WebDriver
|
|
69
|
-
end # Selenium
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
#
|
|
23
|
-
# @api private
|
|
24
|
-
# @see ActionBuilder
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
class Mouse
|
|
28
|
-
def initialize(bridge)
|
|
29
|
-
@bridge = bridge
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def click(element = nil)
|
|
33
|
-
move_if_needed element
|
|
34
|
-
@bridge.click
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def double_click(element = nil)
|
|
38
|
-
move_if_needed element
|
|
39
|
-
@bridge.double_click
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def context_click(element = nil)
|
|
43
|
-
move_if_needed element
|
|
44
|
-
@bridge.context_click
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def down(element = nil)
|
|
48
|
-
move_if_needed element
|
|
49
|
-
@bridge.mouse_down
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def up(element = nil)
|
|
53
|
-
move_if_needed element
|
|
54
|
-
@bridge.mouse_up
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
#
|
|
58
|
-
# Move the mouse.
|
|
59
|
-
#
|
|
60
|
-
# Examples:
|
|
61
|
-
#
|
|
62
|
-
# driver.mouse.move_to(element)
|
|
63
|
-
# driver.mouse.move_to(element, 5, 5)
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
def move_to(element, right_by = nil, down_by = nil)
|
|
67
|
-
assert_element element
|
|
68
|
-
|
|
69
|
-
@bridge.mouse_move_to element.ref, right_by, down_by
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def move_by(right_by, down_by)
|
|
73
|
-
@bridge.mouse_move_to nil, Integer(right_by), Integer(down_by)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
private
|
|
77
|
-
|
|
78
|
-
def move_if_needed(element)
|
|
79
|
-
move_to element if element
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def assert_element(element)
|
|
83
|
-
return if element.is_a? Element
|
|
84
|
-
raise TypeError, "expected #{Element}, got #{element.inspect}:#{element.class}"
|
|
85
|
-
end
|
|
86
|
-
end # Mouse
|
|
87
|
-
end # WebDriver
|
|
88
|
-
end # Selenium
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
class TouchActionBuilder < ActionBuilder
|
|
23
|
-
#
|
|
24
|
-
# @api private
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
def initialize(mouse, keyboard, touch_screen)
|
|
28
|
-
super(mouse, keyboard)
|
|
29
|
-
@devices[:touch_screen] = touch_screen
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def scroll(*args)
|
|
33
|
-
unless [2, 3].include? args.size
|
|
34
|
-
raise ArgumentError, "wrong number of arguments, expected 2..3, got #{args.size}"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
@actions << [:touch_screen, :scroll, args]
|
|
38
|
-
self
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def flick(*args)
|
|
42
|
-
unless [2, 4].include? args.size
|
|
43
|
-
raise ArgumentError, "wrong number of arguments, expected 2 or 4, got #{args.size}"
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
@actions << [:touch_screen, :flick, args]
|
|
47
|
-
self
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def single_tap(element)
|
|
51
|
-
@actions << [:touch_screen, :single_tap, [element]]
|
|
52
|
-
self
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def double_tap(element)
|
|
56
|
-
@actions << [:touch_screen, :double_tap, [element]]
|
|
57
|
-
self
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def long_press(element)
|
|
61
|
-
@actions << [:touch_screen, :long_press, [element]]
|
|
62
|
-
self
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def down(x, y = nil)
|
|
66
|
-
@actions << [:touch_screen, :down, [x, y]]
|
|
67
|
-
self
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def up(x, y = nil)
|
|
71
|
-
@actions << [:touch_screen, :up, [x, y]]
|
|
72
|
-
self
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def move(x, y = nil)
|
|
76
|
-
@actions << [:touch_screen, :move, [x, y]]
|
|
77
|
-
self
|
|
78
|
-
end
|
|
79
|
-
end # TouchActionBuilder
|
|
80
|
-
end # WebDriver
|
|
81
|
-
end # Selenium
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
class TouchScreen
|
|
23
|
-
FLICK_SPEED = {normal: 0, fast: 1}.freeze
|
|
24
|
-
|
|
25
|
-
#
|
|
26
|
-
# @api private
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
def initialize(bridge)
|
|
30
|
-
@bridge = bridge
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def single_tap(element)
|
|
34
|
-
assert_element element
|
|
35
|
-
@bridge.touch_single_tap element.ref
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def double_tap(element)
|
|
39
|
-
assert_element element
|
|
40
|
-
@bridge.touch_double_tap element.ref
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def long_press(element)
|
|
44
|
-
assert_element element
|
|
45
|
-
@bridge.touch_long_press element.ref
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def down(x, y = nil)
|
|
49
|
-
x, y = coords_from x, y
|
|
50
|
-
@bridge.touch_down x, y
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def up(x, y = nil)
|
|
54
|
-
x, y = coords_from x, y
|
|
55
|
-
@bridge.touch_up x, y
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def move(x, y = nil)
|
|
59
|
-
x, y = coords_from x, y
|
|
60
|
-
@bridge.touch_move x, y
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def scroll(*args)
|
|
64
|
-
case args.size
|
|
65
|
-
when 2
|
|
66
|
-
x_offset, y_offset = args
|
|
67
|
-
@bridge.touch_scroll nil, Integer(x_offset), Integer(y_offset)
|
|
68
|
-
when 3
|
|
69
|
-
element, x_offset, y_offset = args
|
|
70
|
-
assert_element element
|
|
71
|
-
@bridge.touch_scroll element.ref, Integer(x_offset), Integer(y_offset)
|
|
72
|
-
else
|
|
73
|
-
raise ArgumentError, "wrong number of arguments, expected 2..3, got #{args.size}"
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def flick(*args)
|
|
78
|
-
case args.size
|
|
79
|
-
when 2
|
|
80
|
-
x_speed, y_speed = args
|
|
81
|
-
@bridge.touch_flick Integer(x_speed), Integer(y_speed)
|
|
82
|
-
when 4
|
|
83
|
-
element, xoffset, yoffset, speed = args
|
|
84
|
-
|
|
85
|
-
assert_element element
|
|
86
|
-
flick_speed = FLICK_SPEED[speed.to_sym]
|
|
87
|
-
|
|
88
|
-
unless flick_speed
|
|
89
|
-
raise ArgumentError, "expected one of #{FLICK_SPEED.keys.inspect}, got #{speed.inspect}"
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
@bridge.touch_element_flick element.ref, Integer(xoffset), Integer(yoffset), flick_speed
|
|
93
|
-
else
|
|
94
|
-
raise ArgumentError, "wrong number of arguments, expected 2 or 4, got #{args.size}"
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
private
|
|
99
|
-
|
|
100
|
-
def coords_from(x, y)
|
|
101
|
-
if y.nil?
|
|
102
|
-
point = x
|
|
103
|
-
|
|
104
|
-
unless point.respond_to?(:x) && point.respond_to?(:y)
|
|
105
|
-
raise ArgumentError, "expected #{point.inspect} to respond to :x and :y"
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
x = point.x
|
|
109
|
-
y = point.y
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
[Integer(x), Integer(y)]
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def assert_element(element)
|
|
116
|
-
return if element.is_a? Element
|
|
117
|
-
raise TypeError, "expected #{Element}, got #{element.inspect}:#{element.class}"
|
|
118
|
-
end
|
|
119
|
-
end # TouchScreen
|
|
120
|
-
end # WebDriver
|
|
121
|
-
end # Selenium
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
|
5
|
-
# distributed with this work for additional information
|
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
|
8
|
-
# "License"); you may not use this file except in compliance
|
|
9
|
-
# with the License. You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
|
14
|
-
# software distributed under the License is distributed on an
|
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
# KIND, either express or implied. See the License for the
|
|
17
|
-
# specific language governing permissions and limitations
|
|
18
|
-
# under the License.
|
|
19
|
-
|
|
20
|
-
module Selenium
|
|
21
|
-
module WebDriver
|
|
22
|
-
module Error
|
|
23
|
-
class WebDriverError < StandardError; end
|
|
24
|
-
|
|
25
|
-
#
|
|
26
|
-
# An attempt was made to select an element that cannot be selected.
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
class ElementNotSelectableError < WebDriverError; end
|
|
30
|
-
|
|
31
|
-
#
|
|
32
|
-
# An element command could not be completed because the element is
|
|
33
|
-
# not visible on the page.
|
|
34
|
-
#
|
|
35
|
-
|
|
36
|
-
class ElementNotVisibleError < WebDriverError; end
|
|
37
|
-
|
|
38
|
-
#
|
|
39
|
-
# The arguments passed to a command are either invalid or malformed.
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
class InvalidArgumentError < WebDriverError; end
|
|
43
|
-
|
|
44
|
-
#
|
|
45
|
-
# An illegal attempt was made to set a cookie under a different
|
|
46
|
-
# domain than the current page.
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
class InvalidCookieDomainError < WebDriverError; end
|
|
50
|
-
|
|
51
|
-
#
|
|
52
|
-
# The coordinates provided to an interactions operation are invalid.
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
class InvalidElementCoordinatesError < WebDriverError; end
|
|
56
|
-
|
|
57
|
-
#
|
|
58
|
-
# An element command could not be completed because the element is
|
|
59
|
-
# in an invalid state, e.g. attempting to click an element that is no
|
|
60
|
-
# longer attached to the document.
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
-
class InvalidElementStateError < WebDriverError; end
|
|
64
|
-
|
|
65
|
-
#
|
|
66
|
-
# Argument was an invalid selector.
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
class InvalidSelectorError < WebDriverError; end
|
|
70
|
-
|
|
71
|
-
#
|
|
72
|
-
# Occurs if the given session id is not in the list of active sessions,
|
|
73
|
-
# meaning the session either does not exist or that it's not active.
|
|
74
|
-
#
|
|
75
|
-
|
|
76
|
-
class InvalidSessionIdError < WebDriverError; end
|
|
77
|
-
|
|
78
|
-
#
|
|
79
|
-
# An error occurred while executing JavaScript supplied by the user.
|
|
80
|
-
#
|
|
81
|
-
|
|
82
|
-
class JavascriptError < WebDriverError; end
|
|
83
|
-
|
|
84
|
-
#
|
|
85
|
-
# The target for mouse interaction is not in the browser's viewport and
|
|
86
|
-
# cannot be brought into that viewport.
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
class MoveTargetOutOfBoundsError < WebDriverError; end
|
|
90
|
-
|
|
91
|
-
#
|
|
92
|
-
# An attempt was made to operate on a modal dialog when one was not open.
|
|
93
|
-
#
|
|
94
|
-
|
|
95
|
-
class NoSuchAlertError < WebDriverError; end
|
|
96
|
-
|
|
97
|
-
#
|
|
98
|
-
# An element could not be located on the page using the given
|
|
99
|
-
# search parameters.
|
|
100
|
-
#
|
|
101
|
-
|
|
102
|
-
class NoSuchElementError < WebDriverError; end
|
|
103
|
-
|
|
104
|
-
#
|
|
105
|
-
# A request to switch to a frame could not be satisfied because the
|
|
106
|
-
# frame could not be found.
|
|
107
|
-
#
|
|
108
|
-
|
|
109
|
-
class NoSuchFrameError < WebDriverError; end
|
|
110
|
-
|
|
111
|
-
#
|
|
112
|
-
# A request to switch to a window could not be satisfied because the
|
|
113
|
-
# window could not be found.
|
|
114
|
-
#
|
|
115
|
-
|
|
116
|
-
class NoSuchWindowError < WebDriverError; end
|
|
117
|
-
|
|
118
|
-
#
|
|
119
|
-
# A script did not complete before its timeout expired.
|
|
120
|
-
#
|
|
121
|
-
|
|
122
|
-
class ScriptTimeoutError < WebDriverError; end
|
|
123
|
-
|
|
124
|
-
#
|
|
125
|
-
# A new session could not be created.
|
|
126
|
-
#
|
|
127
|
-
|
|
128
|
-
class SessionNotCreatedError < WebDriverError; end
|
|
129
|
-
|
|
130
|
-
#
|
|
131
|
-
# An element command failed because the referenced element is no longer
|
|
132
|
-
# attached to the DOM.
|
|
133
|
-
#
|
|
134
|
-
|
|
135
|
-
class StaleElementReferenceError < WebDriverError; end
|
|
136
|
-
|
|
137
|
-
#
|
|
138
|
-
# An operation did not complete before its timeout expired.
|
|
139
|
-
#
|
|
140
|
-
|
|
141
|
-
class TimeoutError < WebDriverError; end
|
|
142
|
-
|
|
143
|
-
#
|
|
144
|
-
# A request to set a cookie's value could not be satisfied.
|
|
145
|
-
#
|
|
146
|
-
|
|
147
|
-
class UnableToSetCookieError < WebDriverError; end
|
|
148
|
-
|
|
149
|
-
#
|
|
150
|
-
# A screen capture was made impossible.
|
|
151
|
-
#
|
|
152
|
-
|
|
153
|
-
class UnableToCaptureScreenError < WebDriverError; end
|
|
154
|
-
|
|
155
|
-
#
|
|
156
|
-
# A modal dialog was open, blocking this operation.
|
|
157
|
-
#
|
|
158
|
-
|
|
159
|
-
class UnexpectedAlertOpenError < WebDriverError; end
|
|
160
|
-
|
|
161
|
-
#
|
|
162
|
-
# An unknown error occurred in the remote end while processing
|
|
163
|
-
# the command.
|
|
164
|
-
#
|
|
165
|
-
|
|
166
|
-
class UnknownError < WebDriverError; end
|
|
167
|
-
|
|
168
|
-
#
|
|
169
|
-
# The requested command matched a known URL but did not match a
|
|
170
|
-
# method for that URL.
|
|
171
|
-
#
|
|
172
|
-
|
|
173
|
-
class UnknownMethodError < WebDriverError; end
|
|
174
|
-
|
|
175
|
-
#
|
|
176
|
-
# Indicates that a command that should have executed properly cannot be supported for some reason.
|
|
177
|
-
#
|
|
178
|
-
|
|
179
|
-
class UnsupportedOperationError < WebDriverError; end
|
|
180
|
-
|
|
181
|
-
# aliased for backwards compatibility
|
|
182
|
-
NoAlertPresentError = NoSuchAlertError
|
|
183
|
-
ScriptTimeOutError = ScriptTimeoutError
|
|
184
|
-
ObsoleteElementError = StaleElementReferenceError
|
|
185
|
-
UnhandledError = UnknownError
|
|
186
|
-
UnexpectedJavascriptError = JavascriptError
|
|
187
|
-
NoAlertOpenError = NoAlertPresentError
|
|
188
|
-
ElementNotDisplayedError = ElementNotVisibleError
|
|
189
|
-
end # Error
|
|
190
|
-
end # WebDriver
|
|
191
|
-
end # Selenium
|