webdriver 0.10.0 → 0.14.0

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: 54136818f569b858653a2e8b1c3c254c3ac1de3cbe91471d70f14566b6831dba
4
- data.tar.gz: 2dd30468267b9bec0a22356cadf1231d6e4f4088aadcffb9178ed1cbaead63a5
3
+ metadata.gz: 87f477a3a44d441f4dcf3dc63299d41e0048ef0dfafb444af95bef91449ea409
4
+ data.tar.gz: 738fd35129209fa04c78ac8931dfd2bd4fd6a8aceb5f27be5f54a042a90173d6
5
5
  SHA512:
6
- metadata.gz: fe04903aa48f907ef9db28b9cb805316891719cc6a159ae41369d5a47e73165fe3f0e8f46c1142d18ceb2d74da1d57ff991f36875ff0336e1ed6b590aad7532d
7
- data.tar.gz: 4945825e44a81b9e6eafd748ffe24c37188ac7181fd792da9fdfbebb2d42f63fdacccf84609853c3e837476179ffd00140e4f0feaa3673e39718b811abfb8497
6
+ metadata.gz: f3f51e54449851f554bf0bb84f020733f6313bf452065e467431e7f2980b37346e056cc1e05f79e7920a752cf1688fbbe716a5074bc842c62376c2bbe5ec3e4d
7
+ data.tar.gz: 98b70012361723d8a7fac8d4efd3bb316a2efbfadc20e688c7e3bd2a5cc51c27d28d1254c962fc4f618ebc5600d774bc9642b7743e72f3c8395f62110ab2fb72
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webdriver (0.10.0)
4
+ webdriver (0.14.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -42,7 +42,11 @@ module Webdriver
42
42
  session_id = response_body.dig "sessionId"
43
43
  value = response_body.dig "value"
44
44
 
45
+
45
46
  case status
47
+ when nil
48
+ # application_status_cache
49
+ value
46
50
  when 0
47
51
  # POST /session has different response structure than other calls
48
52
  if method == :post && path == "/session"
@@ -50,10 +54,18 @@ module Webdriver
50
54
  else # everything else works like this
51
55
  value
52
56
  end
57
+ when 7
58
+ raise Webdriver::NoSuchElementError.new value.dig("message")
59
+ when 8
60
+ raise Webdriver::NoSuchFrameError.new body[:id]
53
61
  when 10
54
- raise Webdriver::StaleElementReferenceError
62
+ raise Webdriver::StaleElementReferenceError.new path
55
63
  when 11
56
- raise Webdriver::ElementNotInteractableError
64
+ raise Webdriver::ElementNotInteractableError.new path
65
+ when 13
66
+ raise Webdriver::UnknownErrorUnhandledInspectorError.new value.dig("message")
67
+ when 28
68
+ raise Webdriver::ScriptTimeout.new value.dig("message")
57
69
  when 1..nil
58
70
  error_message = value.dig("message")
59
71
  raise "#{status}: #{error_message}"
@@ -61,7 +73,7 @@ module Webdriver
61
73
  if method == :get && path == "/status"
62
74
  value
63
75
  else
64
- raise [:unknown, response_body]
76
+ raise "unknown status: #{status}"
65
77
  end
66
78
  end
67
79
  end
@@ -14,6 +14,14 @@ module Webdriver
14
14
  @id == other.id
15
15
  end
16
16
 
17
+ def location_in_view
18
+ @connection.get "location_in_view"
19
+ end
20
+
21
+ def size
22
+ @connection.get "size"
23
+ end
24
+
17
25
  def screenshot
18
26
  @connection.get "screenshot"
19
27
  end
@@ -1,6 +1,14 @@
1
1
  module Webdriver
2
+ # 7
3
+ class NoSuchElementError < StandardError; end
4
+ # 7
5
+ class NoSuchFrameError < StandardError; end
2
6
  # 10
3
7
  class StaleElementReferenceError < StandardError; end
4
8
  # 11
5
9
  class ElementNotInteractableError < StandardError; end
10
+ # 13
11
+ class UnknownErrorUnhandledInspectorError < StandardError; end
12
+ # 28
13
+ class ScriptTimeout < StandardError; end
6
14
  end
@@ -17,16 +17,89 @@ module Webdriver
17
17
  value.map { |id| Webdriver::Window.new id, @connection }
18
18
  end
19
19
 
20
+ def chromium_send_command_and_get_result! opts
21
+ # cmd: "Browser.getVersion", params: {}
22
+ @connection.post "chromium/send_command_and_get_result", {}, opts
23
+ end
24
+
25
+ def is_loading?
26
+ @connection.get "is_loading"
27
+ end
28
+
29
+ def page_freeze!
30
+ @connection.post "goog/page/freeze"
31
+ end
32
+
33
+ def page_resume!
34
+ # needs window min/max / timeout to resume
35
+ @connection.post "goog/page/resume"
36
+ end
37
+
38
+ # https://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Keys
39
+ # enter "\ue007"
40
+ def keys= opts
41
+ @connection.post "keys", {}, opts
42
+ end
43
+
44
+ def moveto! opts
45
+ # xoffset, yoffset, element
46
+ @connection.post "moveto", {}, opts
47
+ end
48
+
49
+ def location
50
+ @connection.get "location"
51
+ end
52
+
53
+ def location! opts
54
+ #{location: {latitude: 20, longitude:20}}
55
+ @connection.post "location", {}, opts
56
+ end
57
+
58
+ def reporting_generate_test_report! opts
59
+ @connection.post "reporting/generate_test_report", {}, opts
60
+ end
61
+
62
+ def timeouts
63
+ @connection.get "timeouts"
64
+ end
65
+
66
+ def timeouts! opts
67
+ @connection.post "timeouts", {}, opts
68
+ self
69
+ end
70
+
71
+ def timeouts_async_script! opts
72
+ @connection.post "timeouts/async_script", {}, opts
73
+ end
74
+
75
+ def log_types
76
+ @connection.get "log/types"
77
+ end
78
+
79
+ def log type
80
+ @connection.post "log", {}, {
81
+ type: type
82
+ }
83
+ end
84
+
85
+ def application_cache_status
86
+ @connection.get "application_cache/status"
87
+ end
88
+
20
89
  # not implemented in chromedriver
21
- # def source
22
- # @connection.post "source"
23
- # end
90
+ def source
91
+ @connection.get "source"
92
+ end
93
+
94
+ def chromium_heap_snapshot
95
+ @connection.get "chromium/heap_snapshot"
96
+ end
24
97
 
25
98
  def chromium_network_conditions
26
99
  @connection.get "chromium/network_conditions"
27
100
  end
28
101
 
29
- def chromium_network_conditions=(conditions)
102
+ def chromium_network_conditions! conditions
30
103
  @connection.post "chromium/network_conditions", {}, conditions
31
104
  self
32
105
  end
@@ -163,15 +236,18 @@ module Webdriver
163
236
  end
164
237
  end
165
238
 
166
- # not implemented in chromedriver
167
- # def print!
168
- # @connection.post "print"
169
- # end
239
+ def print! opts
240
+ @connection.post "print", {}, opts
241
+ end
170
242
 
171
243
  def screenshot
172
244
  @connection.get "screenshot"
173
245
  end
174
246
 
247
+ def screenshot_full
248
+ @connection.get "screenshot/full"
249
+ end
250
+
175
251
  # when moving with tab, or clicked
176
252
  def active_element
177
253
  el = @connection.get "element/active"
@@ -1,3 +1,3 @@
1
1
  module Webdriver
2
- VERSION = "0.10.0"
2
+ VERSION = "0.14.0"
3
3
  end
@@ -3,7 +3,20 @@ module Webdriver
3
3
  attr_reader :id
4
4
  def initialize(id, connection)
5
5
  @id = id
6
- @connection = Webdriver::PrefixConnection.new "window", connection
6
+ @session_connection = connection
7
+ @connection = Webdriver::PrefixConnection.new "window/#{@id}", connection
8
+ end
9
+
10
+ def size
11
+ @connection.get "size"
12
+ end
13
+
14
+ def position
15
+ @connection.get "position"
16
+ end
17
+
18
+ def position! opts
19
+ @connection.post "position", {}, opts
7
20
  end
8
21
 
9
22
  def maximize!
@@ -12,22 +25,22 @@ module Webdriver
12
25
  end
13
26
 
14
27
  def minimize!
15
- @connection.post "minimize"
28
+ @session_connection.post "window/minimize"
16
29
  self
17
30
  end
18
31
 
19
32
  def rect! width: nil, height: nil, x: nil, y:nil
20
- @connection.post("rect", {}, {
33
+ @session_connection.post "window/rect", {}, {
21
34
  width: width,
22
35
  height: height,
23
36
  x: x,
24
37
  y: y
25
- })
38
+ }
26
39
  self
27
40
  end
28
41
 
29
42
  def rect
30
- @connection.get "rect"
43
+ @session_connection.get "window/rect"
31
44
  end
32
45
 
33
46
  def fullscreen!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matti Paksula
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-14 00:00:00.000000000 Z
11
+ date: 2020-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler