appium_lib_core 4.7.1 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/unittest.yml +2 -2
- data/CHANGELOG.md +9 -13
- data/README.md +1 -2
- data/Rakefile +0 -4
- data/appium_lib_core.gemspec +4 -4
- data/ci-jobs/functional_test.yml +1 -1
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +98 -15
- data/lib/appium_lib_core/common/base/bridge.rb +17 -102
- data/lib/appium_lib_core/common/base/capabilities.rb +3 -3
- data/lib/appium_lib_core/common/base/command.rb +123 -2
- data/lib/appium_lib_core/common/base/driver.rb +42 -88
- data/lib/appium_lib_core/common/base/has_location.rb +4 -11
- data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
- data/lib/appium_lib_core/common/base.rb +0 -1
- data/lib/appium_lib_core/common/command.rb +0 -1
- data/lib/appium_lib_core/common/error.rb +1 -4
- data/lib/appium_lib_core/device.rb +0 -4
- data/lib/appium_lib_core/driver.rb +4 -4
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +0 -33
- data/script/commands.rb +2 -25
- metadata +18 -25
- data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -108
- data/lib/appium_lib_core/common/command/mjsonwp.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd462f64262abe99f03dd5a421f2a2dd9c8064f1d44eff47bc1872a834793d27
|
4
|
+
data.tar.gz: 1a1ca492c3551d8c992e9f2b740460e67239887400602351423062e49912b73f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9e4977dfb93ce734c59af5053a6331bfc2038bd3a03757a31fd7e48c3cdcc810204fb6f3027a1120afe91eda31ad61aa504fa25fdf2a2a21d36638c27982f8e
|
7
|
+
data.tar.gz: 3e23c561984a3ad4bf4214aad79fc730f8673d0bc29c81d26ff5143c0dbeb38d6eacc9278ba0caa11e4dfc51f82267f79b97efe6937ad8315c837e64876df162
|
@@ -11,7 +11,7 @@ jobs:
|
|
11
11
|
strategy:
|
12
12
|
fail-fast: false
|
13
13
|
matrix:
|
14
|
-
ruby: [2.
|
14
|
+
ruby: [2.5, 2.6, 2.7, 3.0]
|
15
15
|
|
16
16
|
runs-on: ubuntu-latest
|
17
17
|
|
@@ -38,7 +38,7 @@ jobs:
|
|
38
38
|
fail-fast: false
|
39
39
|
matrix:
|
40
40
|
# Does not add 2.7 on Windows so far since a command fails only on Windows
|
41
|
-
ruby: [2.
|
41
|
+
ruby: [2.5, 2.6]
|
42
42
|
|
43
43
|
runs-on: windows-latest
|
44
44
|
|
data/CHANGELOG.md
CHANGED
@@ -10,26 +10,22 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
-
## [
|
13
|
+
## [5.0.0.beta1]
|
14
14
|
|
15
|
-
|
16
|
-
-
|
15
|
+
- Update base selenium webdriver version to `4.0.0.beta2`
|
16
|
+
- Support only W3C spec
|
17
|
+
- Support Ruby 2.5+
|
17
18
|
|
18
|
-
## [4.
|
19
|
+
## [4.5.0] - 2021-03-14
|
19
20
|
|
20
21
|
### Enhancements
|
21
|
-
- Add `
|
22
|
-
|
23
|
-
## [4.6.0] - 2021-06-03
|
22
|
+
- Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
|
23
|
+
- Add `multiple` and `match_neighbour_threshold` arguments for `Appium::Core::Base::Driver#find_image_occurrence`
|
24
24
|
|
25
|
-
###
|
26
|
-
- Add `Appium::Core::Base::Driver#add_command` to allow you to add your own command
|
25
|
+
### Bug fixes
|
27
26
|
|
28
|
-
|
27
|
+
### Deprecations
|
29
28
|
|
30
|
-
### Enhancements
|
31
|
-
- Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
|
32
|
-
- Add `multiple` and `match_neighbour_threshold` arguments for `Appium::Core::Base::Driver#find_image_occurrence`
|
33
29
|
|
34
30
|
## [4.4.1(4.4.0)] - 2021-02-15(2021-02-13)
|
35
31
|
|
data/README.md
CHANGED
@@ -11,7 +11,6 @@ This library wraps [selenium-webdriver](https://github.com/SeleniumHQ/selenium/w
|
|
11
11
|
# Documentation
|
12
12
|
|
13
13
|
- http://www.rubydoc.info/github/appium/ruby_lib_core
|
14
|
-
- You can find working API examples in test code, [test/functional](test/functional)
|
15
14
|
|
16
15
|
# Related library
|
17
16
|
- https://github.com/appium/ruby_lib
|
@@ -121,7 +120,7 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
|
|
121
120
|
$ ruby test.rb
|
122
121
|
```
|
123
122
|
|
124
|
-
More examples are in [test/functional](test/functional)
|
123
|
+
More examples are in [test/functional](test/functional)
|
125
124
|
|
126
125
|
### Capabilities
|
127
126
|
|
data/Rakefile
CHANGED
@@ -38,7 +38,6 @@ namespace :test do
|
|
38
38
|
namespace :unit do
|
39
39
|
desc('Run all iOS related unit tests in test directory')
|
40
40
|
Rake::TestTask.new(:ios) do |t|
|
41
|
-
ENV['UNIT_TEST'] = '1'
|
42
41
|
t.libs << 'test'
|
43
42
|
t.libs << 'lib'
|
44
43
|
t.test_files = FileList['test/unit/ios/**/*_test.rb']
|
@@ -46,7 +45,6 @@ namespace :test do
|
|
46
45
|
|
47
46
|
desc('Run all Android related unit tests in test directory')
|
48
47
|
Rake::TestTask.new(:android) do |t|
|
49
|
-
ENV['UNIT_TEST'] = '1'
|
50
48
|
t.libs << 'test'
|
51
49
|
t.libs << 'lib'
|
52
50
|
t.test_files = FileList['test/unit/android/**/*_test.rb']
|
@@ -54,7 +52,6 @@ namespace :test do
|
|
54
52
|
|
55
53
|
desc('Run all common related unit tests in test directory')
|
56
54
|
Rake::TestTask.new(:common) do |t|
|
57
|
-
ENV['UNIT_TEST'] = '1'
|
58
55
|
t.libs << 'test'
|
59
56
|
t.libs << 'lib'
|
60
57
|
t.test_files = FileList['test/unit/common/**/*_test.rb']
|
@@ -62,7 +59,6 @@ namespace :test do
|
|
62
59
|
|
63
60
|
desc('Run all Windows related unit tests in test directory')
|
64
61
|
Rake::TestTask.new(:windows) do |t|
|
65
|
-
ENV['UNIT_TEST'] = '1'
|
66
62
|
t.libs << 'test'
|
67
63
|
t.libs << 'lib'
|
68
64
|
t.test_files = FileList['test/unit/windows/**/*_test.rb']
|
data/appium_lib_core.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'appium_lib_core/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.required_ruby_version = '>= 2.
|
7
|
+
spec.required_ruby_version = '>= 2.5'
|
8
8
|
|
9
9
|
spec.name = 'appium_lib_core'
|
10
10
|
spec.version = Appium::Core::VERSION
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_runtime_dependency 'selenium-webdriver', '
|
25
|
+
spec.add_runtime_dependency 'selenium-webdriver', '4.0.0.beta2'
|
26
26
|
spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '>= 1.14'
|
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
31
31
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
32
32
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
33
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
34
|
-
spec.add_development_dependency 'rubocop', '1.
|
33
|
+
spec.add_development_dependency 'webmock', '~> 3.12.1'
|
34
|
+
spec.add_development_dependency 'rubocop', '1.11.0'
|
35
35
|
spec.add_development_dependency 'appium_thor', '~> 1.0'
|
36
36
|
spec.add_development_dependency 'pry'
|
37
37
|
spec.add_development_dependency 'pry-byebug'
|
data/ci-jobs/functional_test.yml
CHANGED
@@ -103,7 +103,7 @@ jobs:
|
|
103
103
|
- template: ./functional/ios_setup.yml
|
104
104
|
parameters:
|
105
105
|
xcodeVersion: ${{ parameters.xcodeForIOS }}
|
106
|
-
- script: brew install ffmpeg && brew tap wix/brew && brew install applesimutils
|
106
|
+
- script: brew install ffmpeg && brew tap wix/brew && brew install wix/brew/applesimutils
|
107
107
|
displayName: Install ffmpeg and applesimutils
|
108
108
|
- template: ./functional/run_appium.yml
|
109
109
|
- script: bundle exec rake test:func:ios TESTS=test/functional/ios/ios/mjpeg_server_test.rb,test/functional/ios/ios/mobile_commands_test.rb
|
@@ -16,7 +16,7 @@ module Appium
|
|
16
16
|
module Core
|
17
17
|
class Base
|
18
18
|
class Bridge
|
19
|
-
class W3C < ::Selenium::WebDriver::Remote::
|
19
|
+
class W3C < ::Selenium::WebDriver::Remote::Bridge
|
20
20
|
include Device::DeviceLock
|
21
21
|
include Device::Keyboard
|
22
22
|
include Device::ImeActions
|
@@ -34,24 +34,108 @@ module Appium
|
|
34
34
|
include Device::ExecuteDriver
|
35
35
|
include Device::Orientation
|
36
36
|
|
37
|
-
|
37
|
+
# TODO: For compatibility. Should remove.
|
38
|
+
def dialect
|
39
|
+
:w3c
|
40
|
+
end
|
38
41
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
# TODO: fixme
|
43
|
+
def browser
|
44
|
+
@browser ||= begin
|
45
|
+
name = @capabilities.browser_name
|
46
|
+
name ? name.tr(' ', '_').downcase.to_sym : 'unknown'
|
47
|
+
rescue KeyError
|
48
|
+
'unknown'
|
49
|
+
end
|
42
50
|
end
|
43
51
|
|
44
|
-
|
45
|
-
|
52
|
+
# Prefix for extra capability defined by W3C
|
53
|
+
APPIUM_PREFIX = 'appium:'
|
54
|
+
|
55
|
+
# Override
|
56
|
+
# Creates session handling both OSS and W3C dialects.
|
57
|
+
#
|
58
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] desired_capabilities A capability
|
59
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
#
|
63
|
+
# opts = {
|
64
|
+
# caps: {
|
65
|
+
# platformName: :ios,
|
66
|
+
# automationName: 'XCUITest',
|
67
|
+
# app: 'test/functional/app/UICatalog.app.zip',
|
68
|
+
# platformVersion: '11.4',
|
69
|
+
# deviceName: 'iPhone Simulator',
|
70
|
+
# useNewWDA: true,
|
71
|
+
# },
|
72
|
+
# appium_lib: {
|
73
|
+
# wait: 30
|
74
|
+
# }
|
75
|
+
# }
|
76
|
+
# core = ::Appium::Core.for(caps)
|
77
|
+
# driver = core.start_driver #=> driver.dialect == :w3c if the Appium server support W3C.
|
78
|
+
#
|
79
|
+
def create_session(desired_capabilities)
|
80
|
+
caps = add_appium_prefix(desired_capabilities)
|
81
|
+
response = execute(:new_session, {}, { capabilities: { firstMatch: [caps] } })
|
82
|
+
|
83
|
+
@session_id = response['sessionId']
|
84
|
+
capabilities = response['capabilities']
|
85
|
+
|
86
|
+
raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload' unless @session_id
|
87
|
+
|
88
|
+
@capabilities = json_create(capabilities)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Append +appium:+ prefix for Appium following W3C spec
|
92
|
+
# https://www.w3.org/TR/webdriver/#dfn-validate-capabilities
|
93
|
+
#
|
94
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] capabilities A capability
|
95
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
96
|
+
def add_appium_prefix(capabilities)
|
97
|
+
w3c_capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
|
98
|
+
|
99
|
+
capabilities = capabilities.__send__(:capabilities) unless capabilities.is_a?(Hash)
|
100
|
+
|
101
|
+
capabilities.each do |name, value|
|
102
|
+
next if value.nil?
|
103
|
+
next if value.is_a?(String) && value.empty?
|
104
|
+
|
105
|
+
capability_name = name.to_s
|
106
|
+
w3c_name = extension_prefix?(capability_name) ? name : "#{APPIUM_PREFIX}#{capability_name}"
|
107
|
+
|
108
|
+
w3c_capabilities[w3c_name] = value
|
109
|
+
end
|
110
|
+
|
111
|
+
w3c_capabilities
|
46
112
|
end
|
47
113
|
|
48
|
-
|
49
|
-
def add_command(method:, url:, name:, &block)
|
50
|
-
::Appium::Logger.info "Overriding the method '#{name}' for '#{url}'" if @available_commands.key? name
|
114
|
+
private
|
51
115
|
|
52
|
-
|
116
|
+
def camel_case(str)
|
117
|
+
str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
|
118
|
+
end
|
53
119
|
|
54
|
-
|
120
|
+
def extension_prefix?(capability_name)
|
121
|
+
snake_cased_capability_names = ::Selenium::WebDriver::Remote::Capabilities::KNOWN.map(&:to_s)
|
122
|
+
camel_cased_capability_names = snake_cased_capability_names.map { |v| camel_case(v) }
|
123
|
+
|
124
|
+
# Check 'EXTENSION_CAPABILITY_PATTERN'
|
125
|
+
snake_cased_capability_names.include?(capability_name) ||
|
126
|
+
camel_cased_capability_names.include?(capability_name) ||
|
127
|
+
capability_name.match(':')
|
128
|
+
end
|
129
|
+
|
130
|
+
def json_create(value)
|
131
|
+
@dialect = :w3c
|
132
|
+
::Selenium::WebDriver::Remote::Capabilities.json_create(value)
|
133
|
+
end
|
134
|
+
|
135
|
+
public
|
136
|
+
|
137
|
+
def commands(command)
|
138
|
+
::Appium::Core::Commands::W3C::COMMANDS[command]
|
55
139
|
end
|
56
140
|
|
57
141
|
# Returns all available sessions on the Appium server instance
|
@@ -92,7 +176,7 @@ module Appium
|
|
92
176
|
|
93
177
|
# Port from MJSONWP
|
94
178
|
def session_capabilities
|
95
|
-
::Selenium::WebDriver::Remote::
|
179
|
+
::Selenium::WebDriver::Remote::Capabilities.json_create execute(:get_capabilities)
|
96
180
|
end
|
97
181
|
|
98
182
|
# Port from MJSONWP
|
@@ -186,10 +270,9 @@ module Appium
|
|
186
270
|
|
187
271
|
# For Appium
|
188
272
|
# No implementation for W3C webdriver module
|
189
|
-
def set_location(lat, lon, alt = 0.0, speed: nil
|
273
|
+
def set_location(lat, lon, alt = 0.0, speed: nil)
|
190
274
|
loc = { latitude: lat, longitude: lon, altitude: alt }
|
191
275
|
loc[:speed] = speed unless speed.nil?
|
192
|
-
loc[:satellites] = satellites unless satellites.nil?
|
193
276
|
execute :set_location, {}, { location: loc }
|
194
277
|
end
|
195
278
|
|
@@ -16,52 +16,16 @@ module Appium
|
|
16
16
|
module Core
|
17
17
|
class Base
|
18
18
|
class Bridge < ::Selenium::WebDriver::Remote::Bridge
|
19
|
+
# TODO: Move W3C module to here
|
20
|
+
|
19
21
|
# Prefix for extra capability defined by W3C
|
20
22
|
APPIUM_PREFIX = 'appium:'
|
21
23
|
|
22
|
-
# TODO: Remove the forceMjsonwp after Appium server won't need it
|
23
|
-
FORCE_MJSONWP = :forceMjsonwp
|
24
|
-
|
25
|
-
# Almost same as self.handshake in ::Selenium::WebDriver::Remote::Bridge
|
26
|
-
#
|
27
|
-
# Implements protocol handshake which:
|
28
|
-
#
|
29
|
-
# 1. Creates session with driver.
|
30
|
-
# 2. Sniffs response.
|
31
|
-
# 3. Based on the response, understands which dialect we should use.
|
32
|
-
#
|
33
|
-
# @return [Bridge::MJSONWP, Bridge::W3C]
|
34
|
-
#
|
35
|
-
def self.handshake(**opts)
|
36
|
-
desired_capabilities = opts.delete(:desired_capabilities) { ::Selenium::WebDriver::Remote::Capabilities.new }
|
37
|
-
|
38
|
-
if desired_capabilities.is_a?(Symbol)
|
39
|
-
unless ::Selenium::WebDriver::Remote::Capabilities.respond_to?(desired_capabilities)
|
40
|
-
raise ::Selenium::WebDriver::Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
|
41
|
-
end
|
42
|
-
|
43
|
-
desired_capabilities = ::Selenium::WebDriver::Remote::Capabilities.__send__(desired_capabilities)
|
44
|
-
end
|
45
|
-
|
46
|
-
bridge = new(opts)
|
47
|
-
capabilities = bridge.create_session(desired_capabilities)
|
48
|
-
|
49
|
-
case bridge.dialect
|
50
|
-
when :oss # for MJSONWP
|
51
|
-
Bridge::MJSONWP.new(capabilities, bridge.session_id, **opts)
|
52
|
-
when :w3c
|
53
|
-
Bridge::W3C.new(capabilities, bridge.session_id, **opts)
|
54
|
-
else
|
55
|
-
raise CoreError, 'cannot understand dialect'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
24
|
# Override
|
60
25
|
# Creates session handling both OSS and W3C dialects.
|
61
|
-
# Copy from Selenium::WebDriver::Remote::Bridge to keep using +merged_capabilities+ for Appium
|
62
26
|
#
|
63
|
-
# @param [::Selenium::WebDriver::Remote::
|
64
|
-
# @return [::Selenium::WebDriver::Remote::Capabilities
|
27
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] desired_capabilities A capability
|
28
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
65
29
|
#
|
66
30
|
# @example
|
67
31
|
#
|
@@ -79,37 +43,27 @@ module Appium
|
|
79
43
|
# }
|
80
44
|
# }
|
81
45
|
# core = ::Appium::Core.for(caps)
|
82
|
-
# driver = core.start_driver
|
46
|
+
# driver = core.start_driver
|
83
47
|
#
|
84
48
|
def create_session(desired_capabilities)
|
85
|
-
|
49
|
+
caps = add_appium_prefix(desired_capabilities)
|
50
|
+
response = execute(:new_session, {}, { capabilities: { firstMatch: [caps] } })
|
86
51
|
|
87
52
|
@session_id = response['sessionId']
|
88
|
-
|
89
|
-
value = response['value']
|
90
|
-
|
91
|
-
if value.is_a?(Hash) # include for W3C format
|
92
|
-
@session_id = value['sessionId'] if value.key?('sessionId')
|
93
|
-
|
94
|
-
if value.key?('capabilities')
|
95
|
-
value = value['capabilities']
|
96
|
-
elsif value.key?('value')
|
97
|
-
value = value['value']
|
98
|
-
end
|
99
|
-
end
|
53
|
+
capabilities = response['capabilities']
|
100
54
|
|
101
55
|
raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload' unless @session_id
|
102
56
|
|
103
|
-
json_create(
|
57
|
+
@capabilities = json_create(capabilities)
|
104
58
|
end
|
105
59
|
|
106
60
|
# Append +appium:+ prefix for Appium following W3C spec
|
107
61
|
# https://www.w3.org/TR/webdriver/#dfn-validate-capabilities
|
108
62
|
#
|
109
|
-
# @param [::Selenium::WebDriver::Remote::
|
110
|
-
# @return [::Selenium::WebDriver::Remote::
|
63
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] capabilities A capability
|
64
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
111
65
|
def add_appium_prefix(capabilities)
|
112
|
-
w3c_capabilities = ::Selenium::WebDriver::Remote::
|
66
|
+
w3c_capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
|
113
67
|
|
114
68
|
capabilities = capabilities.__send__(:capabilities) unless capabilities.is_a?(Hash)
|
115
69
|
|
@@ -133,56 +87,17 @@ module Appium
|
|
133
87
|
end
|
134
88
|
|
135
89
|
def extension_prefix?(capability_name)
|
136
|
-
snake_cased_capability_names = ::Selenium::WebDriver::Remote::
|
90
|
+
snake_cased_capability_names = ::Selenium::WebDriver::Remote::Capabilities::KNOWN.map(&:to_s)
|
137
91
|
camel_cased_capability_names = snake_cased_capability_names.map { |v| camel_case(v) }
|
138
92
|
|
93
|
+
# Check 'EXTENSION_CAPABILITY_PATTERN'
|
139
94
|
snake_cased_capability_names.include?(capability_name) ||
|
140
95
|
camel_cased_capability_names.include?(capability_name) ||
|
141
|
-
capability_name.match(
|
96
|
+
capability_name.match(':')
|
142
97
|
end
|
143
98
|
|
144
|
-
def json_create(
|
145
|
-
|
146
|
-
::Selenium::WebDriver.logger.info 'Detected OSS dialect.'
|
147
|
-
@dialect = :oss
|
148
|
-
::Selenium::WebDriver::Remote::Capabilities.json_create(value)
|
149
|
-
else
|
150
|
-
::Selenium::WebDriver.logger.info 'Detected W3C dialect.'
|
151
|
-
@dialect = :w3c
|
152
|
-
::Selenium::WebDriver::Remote::W3C::Capabilities.json_create(value)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def delete_force_mjsonwp(capabilities)
|
157
|
-
w3c_capabilities = ::Selenium::WebDriver::Remote::W3C::Capabilities.new
|
158
|
-
|
159
|
-
capabilities = capabilities.__send__(:capabilities) unless capabilities.is_a?(Hash)
|
160
|
-
capabilities.each do |name, value|
|
161
|
-
next if value.nil?
|
162
|
-
next if value.is_a?(String) && value.empty?
|
163
|
-
next if name == FORCE_MJSONWP
|
164
|
-
|
165
|
-
w3c_capabilities[name] = value
|
166
|
-
end
|
167
|
-
|
168
|
-
w3c_capabilities
|
169
|
-
end
|
170
|
-
|
171
|
-
def merged_capabilities(desired_capabilities)
|
172
|
-
force_mjsonwp = desired_capabilities[FORCE_MJSONWP]
|
173
|
-
desired_capabilities = delete_force_mjsonwp(desired_capabilities) unless force_mjsonwp.nil?
|
174
|
-
|
175
|
-
::Appium::Logger.warn "'forceMjsonwp' no longer works. Sending both W3C and MJSONWP capabilities" if force_mjsonwp
|
176
|
-
|
177
|
-
new_caps = add_appium_prefix(desired_capabilities)
|
178
|
-
w3c_capabilities = ::Selenium::WebDriver::Remote::W3C::Capabilities.from_oss(new_caps)
|
179
|
-
|
180
|
-
{
|
181
|
-
desiredCapabilities: desired_capabilities,
|
182
|
-
capabilities: {
|
183
|
-
firstMatch: [w3c_capabilities]
|
184
|
-
}
|
185
|
-
}
|
99
|
+
def json_create(value)
|
100
|
+
::Selenium::WebDriver::Remote::Capabilities.json_create(value)
|
186
101
|
end
|
187
102
|
end # class Bridge
|
188
103
|
end # class Base
|
@@ -19,10 +19,10 @@ module Appium
|
|
19
19
|
# @private
|
20
20
|
# @param [Hash] opts_caps Capabilities for Appium server. All capability keys are converted to lowerCamelCase when
|
21
21
|
# this client sends capabilities to Appium server as JSON format.
|
22
|
-
# @return [::Selenium::WebDriver::Remote::
|
23
|
-
# inherited ::Selenium::WebDriver::Remote::
|
22
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities] Return instance of Appium::Core::Base::Capabilities
|
23
|
+
# inherited ::Selenium::WebDriver::Remote::Capabilities
|
24
24
|
def self.create_capabilities(opts_caps = {})
|
25
|
-
::Selenium::WebDriver::Remote::
|
25
|
+
::Selenium::WebDriver::Remote::Capabilities.new(opts_caps)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -16,8 +16,129 @@ module Appium
|
|
16
16
|
module Core
|
17
17
|
class Base
|
18
18
|
module Commands
|
19
|
-
|
20
|
-
|
19
|
+
W3C = {
|
20
|
+
status: [:get, 'status'],
|
21
|
+
|
22
|
+
#
|
23
|
+
# session handling
|
24
|
+
#
|
25
|
+
|
26
|
+
new_session: [:post, 'session'],
|
27
|
+
delete_session: [:delete, 'session/:session_id'],
|
28
|
+
|
29
|
+
#
|
30
|
+
# basic driver
|
31
|
+
#
|
32
|
+
|
33
|
+
get: [:post, 'session/:session_id/url'],
|
34
|
+
get_current_url: [:get, 'session/:session_id/url'],
|
35
|
+
back: [:post, 'session/:session_id/back'],
|
36
|
+
forward: [:post, 'session/:session_id/forward'],
|
37
|
+
refresh: [:post, 'session/:session_id/refresh'],
|
38
|
+
get_title: [:get, 'session/:session_id/title'],
|
39
|
+
|
40
|
+
#
|
41
|
+
# window and Frame handling
|
42
|
+
#
|
43
|
+
|
44
|
+
get_window_handle: [:get, 'session/:session_id/window'],
|
45
|
+
new_window: [:post, 'session/:session_id/window/new'],
|
46
|
+
close_window: [:delete, 'session/:session_id/window'],
|
47
|
+
switch_to_window: [:post, 'session/:session_id/window'],
|
48
|
+
get_window_handles: [:get, 'session/:session_id/window/handles'],
|
49
|
+
fullscreen_window: [:post, 'session/:session_id/window/fullscreen'],
|
50
|
+
minimize_window: [:post, 'session/:session_id/window/minimize'],
|
51
|
+
maximize_window: [:post, 'session/:session_id/window/maximize'],
|
52
|
+
set_window_size: [:post, 'session/:session_id/window/size'],
|
53
|
+
get_window_size: [:get, 'session/:session_id/window/size'],
|
54
|
+
set_window_position: [:post, 'session/:session_id/window/position'],
|
55
|
+
get_window_position: [:get, 'session/:session_id/window/position'],
|
56
|
+
set_window_rect: [:post, 'session/:session_id/window/rect'],
|
57
|
+
get_window_rect: [:get, 'session/:session_id/window/rect'],
|
58
|
+
switch_to_frame: [:post, 'session/:session_id/frame'],
|
59
|
+
switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'],
|
60
|
+
|
61
|
+
#
|
62
|
+
# element
|
63
|
+
#
|
64
|
+
|
65
|
+
find_element: [:post, 'session/:session_id/element'],
|
66
|
+
find_elements: [:post, 'session/:session_id/elements'],
|
67
|
+
find_child_element: [:post, 'session/:session_id/element/:id/element'],
|
68
|
+
find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
|
69
|
+
get_active_element: [:get, 'session/:session_id/element/active'],
|
70
|
+
is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
|
71
|
+
get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
|
72
|
+
get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
|
73
|
+
get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'],
|
74
|
+
get_element_text: [:get, 'session/:session_id/element/:id/text'],
|
75
|
+
get_element_tag_name: [:get, 'session/:session_id/element/:id/name'],
|
76
|
+
get_element_rect: [:get, 'session/:session_id/element/:id/rect'],
|
77
|
+
is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'],
|
78
|
+
|
79
|
+
#
|
80
|
+
# document handling
|
81
|
+
#
|
82
|
+
|
83
|
+
get_page_source: [:get, 'session/:session_id/source'],
|
84
|
+
execute_script: [:post, 'session/:session_id/execute/sync'],
|
85
|
+
execute_async_script: [:post, 'session/:session_id/execute/async'],
|
86
|
+
|
87
|
+
#
|
88
|
+
# cookies
|
89
|
+
#
|
90
|
+
|
91
|
+
get_all_cookies: [:get, 'session/:session_id/cookie'],
|
92
|
+
get_cookie: [:get, 'session/:session_id/cookie/:name'],
|
93
|
+
add_cookie: [:post, 'session/:session_id/cookie'],
|
94
|
+
delete_cookie: [:delete, 'session/:session_id/cookie/:name'],
|
95
|
+
delete_all_cookies: [:delete, 'session/:session_id/cookie'],
|
96
|
+
|
97
|
+
#
|
98
|
+
# timeouts
|
99
|
+
#
|
100
|
+
|
101
|
+
set_timeout: [:post, 'session/:session_id/timeouts'],
|
102
|
+
|
103
|
+
#
|
104
|
+
# actions
|
105
|
+
#
|
106
|
+
|
107
|
+
actions: [:post, 'session/:session_id/actions'],
|
108
|
+
release_actions: [:delete, 'session/:session_id/actions'],
|
109
|
+
print_page: [:post, 'session/:session_id/print'],
|
110
|
+
|
111
|
+
#
|
112
|
+
# Element Operations
|
113
|
+
#
|
114
|
+
|
115
|
+
element_click: [:post, 'session/:session_id/element/:id/click'],
|
116
|
+
element_tap: [:post, 'session/:session_id/element/:id/tap'],
|
117
|
+
element_clear: [:post, 'session/:session_id/element/:id/clear'],
|
118
|
+
element_send_keys: [:post, 'session/:session_id/element/:id/value'],
|
119
|
+
|
120
|
+
#
|
121
|
+
# alerts
|
122
|
+
#
|
123
|
+
|
124
|
+
dismiss_alert: [:post, 'session/:session_id/alert/dismiss'],
|
125
|
+
accept_alert: [:post, 'session/:session_id/alert/accept'],
|
126
|
+
get_alert_text: [:get, 'session/:session_id/alert/text'],
|
127
|
+
send_alert_text: [:post, 'session/:session_id/alert/text'],
|
128
|
+
|
129
|
+
#
|
130
|
+
# screenshot
|
131
|
+
#
|
132
|
+
|
133
|
+
take_screenshot: [:get, 'session/:session_id/screenshot'],
|
134
|
+
take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'],
|
135
|
+
|
136
|
+
#
|
137
|
+
# server extensions
|
138
|
+
#
|
139
|
+
|
140
|
+
upload_file: [:post, 'session/:session_id/se/file']
|
141
|
+
}.freeze
|
21
142
|
end # module Commands
|
22
143
|
end # module Base
|
23
144
|
end # module Core
|