appium_lib_core 5.0.0 → 6.3.0
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 +4 -4
- data/CHANGELOG.md +140 -0
- data/README.md +55 -10
- data/appium_lib_core.gemspec +5 -5
- data/lib/appium_lib_core/common/base/bridge.rb +54 -40
- data/lib/appium_lib_core/common/base/capabilities.rb +8 -16
- data/lib/appium_lib_core/common/base/driver.rb +68 -40
- data/lib/appium_lib_core/common/base/has_location.rb +10 -10
- data/lib/appium_lib_core/common/base/http_default.rb +1 -1
- data/lib/appium_lib_core/common/base/rotable.rb +11 -3
- data/lib/appium_lib_core/common/base/search_context.rb +1 -2
- data/lib/appium_lib_core/common/command.rb +4 -2
- data/lib/appium_lib_core/common/device/app_management.rb +8 -14
- data/lib/appium_lib_core/common/device/value.rb +1 -3
- data/lib/appium_lib_core/common/error.rb +0 -4
- data/lib/appium_lib_core/driver.rb +170 -62
- data/lib/appium_lib_core/support/event_firing_bridge.rb +57 -0
- data/lib/appium_lib_core/version.rb +2 -2
- data/lib/appium_lib_core/{ios/uiautomation/bridge.rb → windows/device/app_management.rb} +20 -12
- data/lib/appium_lib_core/windows/device.rb +2 -0
- data/lib/appium_lib_core.rb +19 -5
- metadata +21 -34
- data/.github/ISSUE_TEMPLATE/issue-report.md +0 -29
- data/.github/contributing.md +0 -26
- data/.github/dependabot.yml +0 -8
- data/.github/issue_template.md +0 -20
- data/.github/workflows/unittest.yml +0 -67
- data/.gitignore +0 -18
- data/.rubocop.yml +0 -146
- data/azure-pipelines.yml +0 -15
- data/ci-jobs/functional/android_setup.yml +0 -3
- data/ci-jobs/functional/ios_setup.yml +0 -7
- data/ci-jobs/functional/publish_test_result.yml +0 -18
- data/ci-jobs/functional/run_appium.yml +0 -25
- data/ci-jobs/functional/start-emulator.sh +0 -26
- data/ci-jobs/functional_test.yml +0 -298
- data/docs/mobile_command.md +0 -34
- data/lib/appium_lib_core/ios/uiautomation/device.rb +0 -44
- data/lib/appium_lib_core/ios/uiautomation/patch.rb +0 -34
- data/lib/appium_lib_core/ios.rb +0 -20
- data/release_notes.md +0 -932
- data/script/commands.rb +0 -166
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c45a558b448d89b1b356b221257279ff8c148680a1dc09f7414877e6e59a6257
|
4
|
+
data.tar.gz: d09d57109c80759c9b92942b7f8e1424c2614f34e4fcdbe9f6d4d0e48ee41816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f50481e6656b18e7dfe5dc631137ab1ab041c9c6087fcf27b1fd24e91814e83ce051f22db1a3e4b41f5d2a4b8320e2ac7c323638e9e9b76d2508d66a7992cdf
|
7
|
+
data.tar.gz: 0b04644ee8c7704080935777b01886cca17acce8dab8c7953b769c9dd9ca33efc588e3da5e08bba6a91f0ac17bde973c607f3b886c4724eb84be3c44aece2690
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,146 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
+
## [6.3.0] - 2023-03-14
|
14
|
+
|
15
|
+
### Enhancements
|
16
|
+
- Support custom listener
|
17
|
+
- e.g. A listener named `CustomListener` which inherits `::Selenium::WebDriver::Support::AbstractEventListener` can set as `appium_lib: { listener: CustomListener.new}` capability
|
18
|
+
|
19
|
+
## [6.2.1] - 2023-03-09
|
20
|
+
|
21
|
+
### Enhancements
|
22
|
+
- Add `uia_device_orientation_landscaperight` and `uia_device_orientation_portrait_upsidedown` symbols in the `drivede.rotation=`
|
23
|
+
- Add `drivede.orientation=` as a syntax sugar of `drivede.rotation=`
|
24
|
+
|
25
|
+
|
26
|
+
## [6.2.0] - 2023-01-26
|
27
|
+
|
28
|
+
### Enhancements
|
29
|
+
|
30
|
+
- Append `selenium-webdriver` `4.8` support
|
31
|
+
- Add `::Appium::Location` since `::Selenium::WebDriver::Location` no longer exists
|
32
|
+
|
33
|
+
### Deprecations
|
34
|
+
|
35
|
+
- `::Selenium::WebDriver::Location` is deprecated in favor of `::Appium::Location` in Appium Ruby binding
|
36
|
+
|
37
|
+
|
38
|
+
## [6.1.0] - 2023-01-18
|
39
|
+
|
40
|
+
### Bug fixes
|
41
|
+
- `Element#immediate_value` sends `text` as the request body
|
42
|
+
|
43
|
+
## [6.0.0] - 2022-12-25
|
44
|
+
- Remove iOS/UiAutomation classes
|
45
|
+
- The version may work for iOS 8. XCUITest driver will be the default behavior for iOS.
|
46
|
+
|
47
|
+
## [5.8.0] - 2022-12-11
|
48
|
+
|
49
|
+
### Enhancements
|
50
|
+
- Add `::Appium::Core::Driver#attach_to` to generate a driver instance which has the given session id.
|
51
|
+
- The primary usage is for debugging to attach to an existing session.
|
52
|
+
|
53
|
+
## [5.7.0] - 2022-12-02
|
54
|
+
|
55
|
+
### Enhancements
|
56
|
+
- Allow selenium webdriver version 4.7 [#423](https://github.com/appium/ruby_lib_core/pull/423)
|
57
|
+
|
58
|
+
## [5.6.0] - 2022-11-08
|
59
|
+
|
60
|
+
### Enhancements
|
61
|
+
- Append `selenium-webdriver` `4.6` support
|
62
|
+
|
63
|
+
## [5.5.2] - 2022-10-11
|
64
|
+
|
65
|
+
### Bug fixes
|
66
|
+
- Fix wrong deprecation message
|
67
|
+
|
68
|
+
## [5.5.1] - 2022-10-10
|
69
|
+
|
70
|
+
### Bug fixes
|
71
|
+
- Keep converting String to Symbol for `capabilities`, `caps` and `appium_lib` for the backward compatibility
|
72
|
+
- Wrong `automationName` and `platformName` detection in this library before starting a session
|
73
|
+
|
74
|
+
### Deprecations
|
75
|
+
- Converting `capabilities`, `caps` and `appium_lib` from String to Symbol
|
76
|
+
- They are expected to be Symbol. Nothing affects existing users who already give the above keys as Symbol for `Appium::Core.for`.
|
77
|
+
|
78
|
+
## [5.5.0] - 2022-10-09
|
79
|
+
|
80
|
+
### Bug fixes
|
81
|
+
- Removed forcefully converting keys of capabilities into symbol, which caused unexpected capabilities format issue [ruby_lib/945](https://github.com/appium/ruby_lib/issues/945)
|
82
|
+
|
83
|
+
## [5.4.0] - 2022-10-01
|
84
|
+
|
85
|
+
### Enhancements
|
86
|
+
- Append `selnium-webdriver` `4.5` support
|
87
|
+
|
88
|
+
## [5.3.0] - 2022-08-10
|
89
|
+
|
90
|
+
### Enhancements
|
91
|
+
|
92
|
+
- Allow selenium webdriver version 4.4 [#404](https://github.com/appium/ruby_lib_core/pull/404)
|
93
|
+
|
94
|
+
## [5.2.2] - 2022-06-26
|
95
|
+
|
96
|
+
### Enhancements
|
97
|
+
- Relax the selenium webdriver version restriction of `4.2.0`
|
98
|
+
|
99
|
+
### Bug fixes
|
100
|
+
- Remove undefined module in selenium webdriver version `4.3.0`
|
101
|
+
|
102
|
+
## [5.2.1] - 2022-06-24
|
103
|
+
|
104
|
+
### Bug fixes
|
105
|
+
- Restrict the selenium webdriver version to `4.2.0`
|
106
|
+
|
107
|
+
## [5.2.0] - 2022-06-19
|
108
|
+
|
109
|
+
### Enhancements
|
110
|
+
|
111
|
+
- Update base Selenium Ruby client to `4.2+`
|
112
|
+
- Please call `key_action` or set `[::Selenium::WebDriver::Interactions.key('keyboard')]` as the deviecs parameter to build `driver.send_keys().perform` W3C action.
|
113
|
+
- `driver.key_action.send_keys('xxx').perform` instead of `driver.action.send_keys('xxx').perform`, or `driver.action(devices: [::Selenium::WebDriver::Interactions.key('keyboard')]).send_keys('xxx').perform`.
|
114
|
+
- [This PR change](https://github.com/appium/ruby_lib_core/pull/381/files) will help to update your some actions.
|
115
|
+
|
116
|
+
## [5.1.2] - 2022-06-02
|
117
|
+
|
118
|
+
### Enhancements
|
119
|
+
|
120
|
+
- Limit selenium webdriver version less than `4.2`
|
121
|
+
|
122
|
+
## [5.1.1] - 2022-04-18
|
123
|
+
|
124
|
+
### Enhancements
|
125
|
+
|
126
|
+
- Remove unneccessry files from gem package to reduce the size.
|
127
|
+
|
128
|
+
## [5.1.0] - 2021-12-25
|
129
|
+
|
130
|
+
### Enhancements
|
131
|
+
- Make default pointerType `touch` for the pointer in W3C actions instead of `mouse` for Appium
|
132
|
+
- This change should not affect W3C actions
|
133
|
+
|
134
|
+
## [5.0.3] - 2021-12-13
|
135
|
+
|
136
|
+
### Enhancements
|
137
|
+
- Can add more arguments in `install_app`
|
138
|
+
- e.g. Add `timeoutMs` for XCUITest driver as `@driver.install_app("/path/to/test.ipa", timeoutMs: 20000)`
|
139
|
+
|
140
|
+
### Bug fixes
|
141
|
+
- (internal) Allow to access to `bridge` attribute in `driver` instance for appium_flutter_finder
|
142
|
+
|
143
|
+
## [5.0.2] - 2021-12-01
|
144
|
+
|
145
|
+
### Bug fixes
|
146
|
+
- (internal) Fix firstMatch format in a new session creation
|
147
|
+
|
148
|
+
## [5.0.1] - 2021-11-23
|
149
|
+
|
150
|
+
### Enhancements
|
151
|
+
- Relaxed version restriction of selenium-webdriver
|
152
|
+
|
13
153
|
## [5.0.0] - 2021-11-05
|
14
154
|
|
15
155
|
### Enhancements
|
data/README.md
CHANGED
@@ -10,12 +10,14 @@ This library wraps [selenium-webdriver](https://github.com/SeleniumHQ/selenium/w
|
|
10
10
|
|
11
11
|
# Documentation
|
12
12
|
|
13
|
-
-
|
13
|
+
- https://www.rubydoc.info/gems/appium_lib_core
|
14
14
|
- You can find working API examples in test code, [test/functional](test/functional)
|
15
|
+
- Appium 2.0
|
16
|
+
- https://appium.github.io/appium/docs/en/2.0/ (Not completed yet)
|
15
17
|
|
16
18
|
# Migration from v4 to v5
|
17
19
|
|
18
|
-
Please read `[5.0.0]` section in CHANGELOG.md
|
20
|
+
Please read [`[5.0.0]`](CHANGELOG.md#500---2021-11-05) section in [CHANGELOG](CHANGELOG.md)
|
19
21
|
|
20
22
|
# Related library
|
21
23
|
- https://github.com/appium/ruby_lib
|
@@ -30,20 +32,29 @@ $ bundle install
|
|
30
32
|
$ bundle exec parallel_test test/unit/
|
31
33
|
```
|
32
34
|
|
35
|
+
or
|
36
|
+
|
37
|
+
```bash
|
38
|
+
$ bundle install
|
39
|
+
$ bundle exec rake test:unit
|
40
|
+
```
|
41
|
+
|
33
42
|
### Functional Tests
|
34
43
|
Run functional tests which require the Appium server and real device, Simulator/Emulator.
|
35
44
|
|
36
|
-
- Start Appium server
|
45
|
+
- Start Appium server (Appium 2.0 base)
|
37
46
|
```bash
|
38
|
-
$ npm install -g appium
|
39
|
-
$ appium
|
47
|
+
$ npm install -g appium@next
|
48
|
+
$ appium driver install xcuitest
|
49
|
+
$ appium driver install uiautomator2 # etc
|
50
|
+
$ appium --base-path=/wd/hub --relaxed-security # To run all tests in local
|
40
51
|
```
|
41
52
|
|
42
53
|
- Conduct tests
|
43
54
|
```bash
|
44
55
|
$ bundle install
|
45
56
|
$ rake test:func:android # Andorid, uiautomator2
|
46
|
-
$
|
57
|
+
$ APPIUM_DRIVER=espresso rake test:func:android # Andorid, uiautomator2
|
47
58
|
$ rake test:func:ios # iOS
|
48
59
|
```
|
49
60
|
|
@@ -99,12 +110,12 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
|
|
99
110
|
require 'appium_lib_core'
|
100
111
|
|
101
112
|
opts = {
|
102
|
-
capabilities: { #
|
103
|
-
platformName:
|
113
|
+
capabilities: { # Append capabilities
|
114
|
+
platformName: 'ios',
|
104
115
|
platformVersion: '11.0',
|
105
116
|
deviceName: 'iPhone Simulator',
|
106
|
-
|
107
|
-
|
117
|
+
# app: '/path/to/MyiOS.app', # Without 'app' capability, an appium session starts with the home screen
|
118
|
+
automationName: 'XCUITest'
|
108
119
|
},
|
109
120
|
appium_lib: {
|
110
121
|
wait: 30
|
@@ -125,13 +136,47 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
|
|
125
136
|
$ ruby test.rb
|
126
137
|
```
|
127
138
|
|
139
|
+
[Appium::Core.for](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver#for-class_method) documentation has more example to build a new driver instance.
|
140
|
+
|
128
141
|
More examples are in [test/functional](test/functional)
|
129
142
|
|
143
|
+
As of version 5.8.0, the client can attach to an existing session. The main purpose is for debugging.
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
# @driver is the driver instance of an existing session
|
147
|
+
attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'XCUITest', platform_name: 'ios'
|
148
|
+
assert attached_driver.session_id == @driver.session_id
|
149
|
+
attached_driver.page_source
|
150
|
+
```
|
151
|
+
|
130
152
|
### Capabilities
|
131
153
|
|
132
154
|
Read [Appium/Core/Driver](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
|
133
155
|
Capabilities affect only ruby_lib is [Appium/Core/Options](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Options).
|
134
156
|
|
157
|
+
|
158
|
+
### Gives custom listener
|
159
|
+
|
160
|
+
An example to define a customer listener with [Selenium::WebDriver::Support::AbstractEventListener](https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/Support/AbstractEventListener.html)
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
class CustomListener < ::Selenium::WebDriver::Support::AbstractEventListener
|
164
|
+
// something
|
165
|
+
end
|
166
|
+
capabilities: {
|
167
|
+
platformName: :ios,
|
168
|
+
platformVersion: '11.0',
|
169
|
+
deviceName: 'iPhone Simulator',
|
170
|
+
automationName: 'XCUITest',
|
171
|
+
app: '/path/to/MyiOS.app'
|
172
|
+
},
|
173
|
+
appium_lib: {
|
174
|
+
listener: CustomListener.new
|
175
|
+
}
|
176
|
+
@core = Appium::Core.for capabilities: capabilities, appium_lib: appium_lib
|
177
|
+
@core.start_driver
|
178
|
+
```
|
179
|
+
|
135
180
|
# Development
|
136
181
|
- Demo app
|
137
182
|
- https://android.googlesource.com/platform/development/+/master/samples/ApiDemos
|
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 = Gem::Requirement.new('>= 2.7')
|
8
8
|
|
9
9
|
spec.name = 'appium_lib_core'
|
10
10
|
spec.version = Appium::Core::VERSION
|
@@ -16,21 +16,21 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = 'https://github.com/appium/ruby_lib_core/'
|
17
17
|
spec.license = 'Apache-2.0'
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
-
f.match(%r{^(doc|test|spec|features)
|
19
|
+
f.match(%r{(^(doc|docs|test|spec|features|ci-jobs|.github|script)/|release_notes.md|.gitignore|azure-pipelines.yml|.rubocop.yml)})
|
20
20
|
end
|
21
21
|
spec.bindir = 'exe'
|
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', '~> 4.
|
25
|
+
spec.add_runtime_dependency 'selenium-webdriver', '~> 4.2', '< 4.9'
|
26
26
|
spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'rake', '~> 13.0'
|
29
29
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
30
30
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
31
31
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
32
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
33
|
-
spec.add_development_dependency 'rubocop', '1.
|
32
|
+
spec.add_development_dependency 'webmock', '~> 3.18.1'
|
33
|
+
spec.add_development_dependency 'rubocop', '1.47.0'
|
34
34
|
spec.add_development_dependency 'appium_thor', '~> 1.0'
|
35
35
|
spec.add_development_dependency 'parallel_tests'
|
36
36
|
spec.add_development_dependency 'simplecov'
|
@@ -43,18 +43,44 @@ module Appium
|
|
43
43
|
|
44
44
|
def browser
|
45
45
|
@browser ||= begin
|
46
|
-
name = @capabilities
|
46
|
+
name = @capabilities&.browser_name
|
47
47
|
name ? name.tr(' ', '_').downcase.to_sym : 'unknown'
|
48
48
|
rescue KeyError
|
49
49
|
APPIUM_NATIVE_BROWSER_NAME
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
# Appium only.
|
54
|
+
# Attach to an existing session.
|
55
|
+
#
|
56
|
+
# @param [String] The session id to attach to.
|
57
|
+
# @param [String] platform_name The platform name to keep in the dummy capabilities
|
58
|
+
# @param [String] platform_name The automation name to keep in the dummy capabilities
|
59
|
+
# @return [::Appium::Core::Base::Capabilities]
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
#
|
63
|
+
# new_driver = ::Appium::Core::Driver.attach_to(
|
64
|
+
# driver.session_id,
|
65
|
+
# url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android'
|
66
|
+
# )
|
67
|
+
#
|
68
|
+
def attach_to(session_id, platform_name, automation_name)
|
69
|
+
@available_commands = ::Appium::Core::Commands::COMMANDS.dup
|
70
|
+
@session_id = session_id
|
71
|
+
|
72
|
+
# generate a dummy capabilities instance which only has the given platformName and automationName
|
73
|
+
@capabilities = ::Appium::Core::Base::Capabilities.new(
|
74
|
+
'platformName' => platform_name,
|
75
|
+
'automationName' => automation_name
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
53
79
|
# Override
|
54
80
|
# Creates session handling.
|
55
81
|
#
|
56
|
-
# @param [::
|
57
|
-
# @return [::
|
82
|
+
# @param [::Appium::Core::Base::Capabilities, Hash] capabilities A capability
|
83
|
+
# @return [::Appium::Core::Base::Capabilities]
|
58
84
|
#
|
59
85
|
# @example
|
60
86
|
#
|
@@ -77,8 +103,8 @@ module Appium
|
|
77
103
|
def create_session(capabilities)
|
78
104
|
@available_commands = ::Appium::Core::Commands::COMMANDS.dup
|
79
105
|
|
80
|
-
|
81
|
-
response = execute(:new_session, {}, { capabilities: { alwaysMatch:
|
106
|
+
always_match = add_appium_prefix(capabilities)
|
107
|
+
response = execute(:new_session, {}, { capabilities: { alwaysMatch: always_match, firstMatch: [{}] } })
|
82
108
|
|
83
109
|
@session_id = response['sessionId']
|
84
110
|
raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload' unless @session_id
|
@@ -89,10 +115,10 @@ module Appium
|
|
89
115
|
# Append +appium:+ prefix for Appium following W3C spec
|
90
116
|
# https://www.w3.org/TR/webdriver/#dfn-validate-capabilities
|
91
117
|
#
|
92
|
-
# @param [::
|
93
|
-
# @return [::
|
118
|
+
# @param [::Appium::Core::Base::Capabilities, Hash] capabilities A capability
|
119
|
+
# @return [::Appium::Core::Base::Capabilities]
|
94
120
|
def add_appium_prefix(capabilities)
|
95
|
-
w3c_capabilities = ::
|
121
|
+
w3c_capabilities = ::Appium::Core::Base::Capabilities.new
|
96
122
|
|
97
123
|
capabilities = capabilities.send(:capabilities) unless capabilities.is_a?(Hash)
|
98
124
|
|
@@ -111,12 +137,12 @@ module Appium
|
|
111
137
|
|
112
138
|
private
|
113
139
|
|
114
|
-
def camel_case(
|
115
|
-
|
140
|
+
def camel_case(str_or_sym)
|
141
|
+
str_or_sym.to_s.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
|
116
142
|
end
|
117
143
|
|
118
144
|
def extension_prefix?(capability_name)
|
119
|
-
snake_cased_capability_names = ::
|
145
|
+
snake_cased_capability_names = ::Appium::Core::Base::Capabilities::KNOWN.map(&:to_s)
|
120
146
|
camel_cased_capability_names = snake_cased_capability_names.map { |v| camel_case(v) }
|
121
147
|
|
122
148
|
# Check 'EXTENSION_CAPABILITY_PATTERN'
|
@@ -126,7 +152,7 @@ module Appium
|
|
126
152
|
end
|
127
153
|
|
128
154
|
def json_create(value)
|
129
|
-
::
|
155
|
+
::Appium::Core::Base::Capabilities.json_create(value)
|
130
156
|
end
|
131
157
|
|
132
158
|
public
|
@@ -153,26 +179,26 @@ module Appium
|
|
153
179
|
execute :status
|
154
180
|
end
|
155
181
|
|
156
|
-
# Perform touch actions for W3C module.
|
182
|
+
# Perform 'touch' actions for W3C module.
|
157
183
|
# Generate +touch+ pointer action here and users can use this via +driver.action+
|
158
184
|
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
|
159
185
|
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
|
160
186
|
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
|
161
187
|
#
|
162
|
-
#
|
163
|
-
# the server side. So we don't consider the case.
|
188
|
+
# The pointer type is 'touch' by default in the Appium Ruby client.
|
164
189
|
#
|
165
190
|
# @example
|
166
191
|
#
|
167
192
|
# element = @driver.find_element(:id, "some id")
|
168
193
|
# @driver.action.click(element).perform # The 'click' is a part of 'PointerActions'
|
169
194
|
#
|
170
|
-
def action(
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
195
|
+
def action(_deprecated_async = nil, async: false, devices: nil)
|
196
|
+
::Selenium::WebDriver::ActionBuilder.new(
|
197
|
+
self,
|
198
|
+
devices: devices || [::Selenium::WebDriver::Interactions.pointer(:touch, name: 'touch')],
|
199
|
+
async: async,
|
200
|
+
duration: 50 # milliseconds
|
201
|
+
)
|
176
202
|
end
|
177
203
|
|
178
204
|
# Port from MJSONWP
|
@@ -182,23 +208,7 @@ module Appium
|
|
182
208
|
|
183
209
|
# Port from MJSONWP
|
184
210
|
def session_capabilities
|
185
|
-
::
|
186
|
-
end
|
187
|
-
|
188
|
-
# Port from MJSONWP
|
189
|
-
def send_keys_to_active_element(key)
|
190
|
-
text = ::Selenium::WebDriver::Keys.encode(key).join
|
191
|
-
execute :send_keys_to_active_element, {}, { value: text.chars }
|
192
|
-
end
|
193
|
-
|
194
|
-
# For Appium
|
195
|
-
# override
|
196
|
-
def page_source
|
197
|
-
# For W3C
|
198
|
-
# execute_script('var source = document.documentElement.outerHTML;' \
|
199
|
-
# 'if (!source) { source = new XMLSerializer().serializeToString(document); }' \
|
200
|
-
# 'return source;')
|
201
|
-
execute :get_page_source
|
211
|
+
::Appium::Core::Base::Capabilities.json_create execute(:get_capabilities)
|
202
212
|
end
|
203
213
|
|
204
214
|
# For Appium
|
@@ -214,7 +224,8 @@ module Appium
|
|
214
224
|
# override
|
215
225
|
def element_attribute(element, name)
|
216
226
|
# For W3C in Selenium Client
|
217
|
-
# execute_atom :getAttribute, element, name
|
227
|
+
# execute_atom :getAttribute, element, name.
|
228
|
+
# 'dom_attribute' in the WebDriver Selenium.
|
218
229
|
execute :get_element_attribute, id: element.id, name: name
|
219
230
|
end
|
220
231
|
|
@@ -291,7 +302,7 @@ module Appium
|
|
291
302
|
# called in 'extend DriverExtensions::HasLocation'
|
292
303
|
def location
|
293
304
|
obj = execute(:get_location) || {}
|
294
|
-
::
|
305
|
+
::Appium::Location.new obj['latitude'], obj['longitude'], obj['altitude']
|
295
306
|
end
|
296
307
|
|
297
308
|
# For Appium
|
@@ -356,6 +367,9 @@ module Appium
|
|
356
367
|
element_id = element_id_from(arg)
|
357
368
|
return ::Appium::Core::Element.new(self, element_id) if element_id
|
358
369
|
|
370
|
+
shadow_root_id = shadow_root_id_from(arg)
|
371
|
+
return ::Selenium::WebDriver::Remote::ShadowRoot.new self, shadow_root_id if shadow_root_id
|
372
|
+
|
359
373
|
arg.each { |k, v| arg[k] = unwrap_script_result(v) }
|
360
374
|
else
|
361
375
|
arg
|
@@ -15,22 +15,14 @@
|
|
15
15
|
module Appium
|
16
16
|
module Core
|
17
17
|
class Base
|
18
|
-
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
# Selenium 5 will have Options instead of 'Capabilities'.
|
27
|
-
# https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/common/options.rb
|
28
|
-
# Then, Ruby client also shoud move to the Options way.
|
29
|
-
# Appium's capabilities could change by depending on Appium versions. So it does not have
|
30
|
-
# standard options like chrome and firefox etc. So, the implementation should differ from
|
31
|
-
# other browsers. But here should inherit `Options` to follow Selenium.
|
32
|
-
::Selenium::WebDriver::Remote::Capabilities.new(opts_caps)
|
33
|
-
end
|
18
|
+
class Capabilities < ::Selenium::WebDriver::Remote::Capabilities
|
19
|
+
# TODO: Move to 'Options' way instead of 'Capabilities'.
|
20
|
+
# Selenium 5 will have Options instead of 'Capabilities'.
|
21
|
+
# https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/common/options.rb
|
22
|
+
# Then, Ruby client also shoud move to the Options way.
|
23
|
+
# Appium's capabilities could change by depending on Appium versions. So it does not have
|
24
|
+
# standard options like chrome and firefox etc. So, the implementation should differ from
|
25
|
+
# other browsers. But here should inherit `Options` to follow Selenium.
|
34
26
|
end
|
35
27
|
end
|
36
28
|
end
|