async-webdriver 0.5.0 → 0.6.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: da08a7e4f4e91c945652030f4616b76e9b087cc84efb98f6ee48c99504407abc
4
- data.tar.gz: bf78251edf46c21d60b73adfa60b3105a9c114a9c0de26454ca59ed1cba85198
3
+ metadata.gz: bf43f03c5d84881a589b4b8ada0b4b610bd81d7434b42387986c2e62be565748
4
+ data.tar.gz: eeeda998354a547586c84f796a74062304510e3778011d18e60bead39ffb9d63
5
5
  SHA512:
6
- metadata.gz: 79921aa72ebc306b70a5615de0aec9b2ffa5e6c56186f08ce781b69837f71911334512148678320da898dcf546f310de9157e554ee65a00bd37b05f6584f6303
7
- data.tar.gz: 7f193306b1552c179a96b8d2ca832b979d6118bea9c8c9a22da5550e454de1b3282605486191727ed5af7cd3eb674c0b231bb8aad82b84f7ad353c08f5c23adf
6
+ metadata.gz: 061ec510b866722f3893e549153532e8053a8aa4301316b338fec0bdd0785d00e7b84257969bfd2622581aecedaf59dd08f375577f051fc64c51ab4411b9fbe0
7
+ data.tar.gz: 73ef488209fcdff4efb657b3c47b61459de197e9303790ed59356e05c6f7553155971b225d2271987da64e7336d5343aa5de4882bf0610c6d435cad369860c86
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2023-2024, by Samuel Williams.
5
+
6
+ require_relative 'generic'
7
+ require_relative 'process_group'
8
+
9
+ module Async
10
+ module WebDriver
11
+ module Bridge
12
+ # A bridge to the Safari browser using `safaridriver`.
13
+ #
14
+ # ``` ruby
15
+ # begin
16
+ # bridge = Async::WebDriver::Bridge::Safari.start
17
+ # client = Async::WebDriver::Client.open(bridge.endpoint)
18
+ # ensure
19
+ # bridge&.close
20
+ # end
21
+ # ```
22
+ class Safari < Generic
23
+ def path
24
+ @options.fetch(:path, "safaridriver")
25
+ end
26
+
27
+ # @returns [String] The version of the `safaridriver` executable.
28
+ def version
29
+ ::IO.popen([self.path, "--version"]) do |io|
30
+ return io.read
31
+ end
32
+ rescue Errno::ENOENT
33
+ return nil
34
+ end
35
+
36
+ class Driver < Bridge::Driver
37
+ def initialize(**options)
38
+ super(**options)
39
+ @process_group = nil
40
+ end
41
+
42
+ # @returns [Array(String)] The arguments to pass to the `safaridriver` executable.
43
+ def arguments(**options)
44
+ [
45
+ options.fetch(:path, "safaridriver"),
46
+ "--port=#{self.port}",
47
+ ].compact
48
+ end
49
+
50
+ def start
51
+ @process_group = ProcessGroup.spawn(*arguments(**@options))
52
+
53
+ super
54
+ end
55
+
56
+ def close
57
+ if @process_group
58
+ @process_group.close
59
+ @process_group = nil
60
+ end
61
+
62
+ super
63
+ end
64
+ end
65
+
66
+ # Start the driver.
67
+ def start(**options)
68
+ Driver.new(**options).tap(&:start)
69
+ end
70
+
71
+ # The default capabilities for the Safari browser which need to be provided when requesting a new session.
72
+ # @parameter headless [Boolean] Whether to run the browser in headless mode.
73
+ # @returns [Hash] The default capabilities for the Safari browser.
74
+ def default_capabilities(headless: self.headless?)
75
+ {
76
+ alwaysMatch: {
77
+ browserName: "safari",
78
+ },
79
+ }
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -5,6 +5,7 @@
5
5
 
6
6
  require_relative 'bridge/chrome'
7
7
  require_relative 'bridge/firefox'
8
+ require_relative 'bridge/safari'
8
9
 
9
10
  require_relative 'error'
10
11
 
@@ -17,6 +18,7 @@ module Async
17
18
  ALL = [
18
19
  Bridge::Chrome,
19
20
  Bridge::Firefox,
21
+ Bridge::Safari,
20
22
  ]
21
23
 
22
24
  def self.each(&block)
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module WebDriver
8
- VERSION = "0.5.0"
8
+ VERSION = "0.6.0"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -123,6 +123,7 @@ files:
123
123
  - lib/async/webdriver/bridge/generic.rb
124
124
  - lib/async/webdriver/bridge/pool.rb
125
125
  - lib/async/webdriver/bridge/process_group.rb
126
+ - lib/async/webdriver/bridge/safari.rb
126
127
  - lib/async/webdriver/client.rb
127
128
  - lib/async/webdriver/element.rb
128
129
  - lib/async/webdriver/error.rb
metadata.gz.sig CHANGED
Binary file