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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9cb1e375d275f60b14e657c80dcbf14ec423551950d80b38ce3d7d82a966eaa
4
- data.tar.gz: ded8a8c068b3dc7e2e0b2c41ab3a9b08ebf2c8160cbe3fc652472c6482272282
3
+ metadata.gz: fd462f64262abe99f03dd5a421f2a2dd9c8064f1d44eff47bc1872a834793d27
4
+ data.tar.gz: 1a1ca492c3551d8c992e9f2b740460e67239887400602351423062e49912b73f
5
5
  SHA512:
6
- metadata.gz: c5b1ea8c1229aac34ae8099b8e2a525b5d8abbd2fdc53da301b65145dcf50e6acf5f74fe84b849dc798f8723c3f48ad1a733bef1556955d42119da8b963b86c5
7
- data.tar.gz: 7bf9af9a23a325010a6c76a927cfea6c96be27285f5b1c7b1ce0d26c5518b9dd553efab63c1df458ca3a2e1d66d26ee42946ca4bd786271dcd81f19ef0730fcd
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.4, 2.5, 2.6, 2.7, 3.0]
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.4, 2.5, 2.6]
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
- ## [4.7.1] - 2021-09-26
13
+ ## [5.0.0.beta1]
14
14
 
15
- ### Enhancements
16
- - Allow to override an existing method by `Appium::Core::Base::Driver#add_command` since Appium drivers/plugins allow to override them
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.7.0] - 2021-07-17
19
+ ## [4.5.0] - 2021-03-14
19
20
 
20
21
  ### Enhancements
21
- - Add `satellites` option in `Appium::Core::Base::Driver#set_location`
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
- ### Enhancements
26
- - Add `Appium::Core::Base::Driver#add_command` to allow you to add your own command
25
+ ### Bug fixes
27
26
 
28
- ## [4.5.0] - 2021-03-14
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']
@@ -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.4'
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', '~> 3.14', '>= 3.14.1'
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.14.0'
34
- spec.add_development_dependency 'rubocop', '1.12.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'
@@ -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::W3C::Bridge
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
- attr_reader :available_commands
37
+ # TODO: For compatibility. Should remove.
38
+ def dialect
39
+ :w3c
40
+ end
38
41
 
39
- def initialize(capabilities, session_id, **opts)
40
- @available_commands = ::Appium::Core::Commands::W3C::COMMANDS.dup
41
- super(capabilities, session_id, **opts)
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
- def commands(command)
45
- @available_commands[command]
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
- # command for Appium 2.0.
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
- @available_commands[name] = [method, url]
116
+ def camel_case(str)
117
+ str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
118
+ end
53
119
 
54
- ::Appium::Core::Device.add_endpoint_method name, &block
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::W3C::Capabilities.json_create execute(:get_capabilities)
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, satellites: 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::W3C::Capabilities, Hash] desired_capabilities A capability
64
- # @return [::Selenium::WebDriver::Remote::Capabilities, ::Selenium::WebDriver::Remote::W3C::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 #=> driver.dialect == :w3c if the Appium server support W3C.
46
+ # driver = core.start_driver
83
47
  #
84
48
  def create_session(desired_capabilities)
85
- response = execute(:new_session, {}, merged_capabilities(desired_capabilities))
49
+ caps = add_appium_prefix(desired_capabilities)
50
+ response = execute(:new_session, {}, { capabilities: { firstMatch: [caps] } })
86
51
 
87
52
  @session_id = response['sessionId']
88
- oss_status = response['status'] # for compatibility with Appium 1.7.1-
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(oss_status, value)
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::W3C::Capabilities, Hash] capabilities A capability
110
- # @return [::Selenium::WebDriver::Remote::W3C::Capabilities]
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::W3C::Capabilities.new
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::W3C::Capabilities::KNOWN.map(&:to_s)
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(::Selenium::WebDriver::Remote::W3C::Capabilities::EXTENSION_CAPABILITY_PATTERN)
96
+ capability_name.match(':')
142
97
  end
143
98
 
144
- def json_create(oss_status, value)
145
- if oss_status
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::W3C::Capabilities] Return instance of Appium::Core::Base::Capabilities
23
- # inherited ::Selenium::WebDriver::Remote::W3C::Capabilities
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::W3C::Capabilities.new(opts_caps)
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
- OSS = ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS.freeze
20
- W3C = ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS.freeze
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