selenium-webdriver 2.47.0 → 2.47.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ 2.47.1 (2015-07-31)
2
+ ===================
3
+
4
+ Edge:
5
+ * Initial implementation of Microsoft's EdgeDriver
6
+
7
+
1
8
  2.47.0 (2015-07-29)
2
9
  ===================
3
10
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- selenium-webdriver (2.47.0.dev)
4
+ selenium-webdriver (2.47.1)
5
5
  childprocess (~> 0.5)
6
6
  multi_json (~> 1.0)
7
7
  rubyzip (~> 1.0)
@@ -35,6 +35,7 @@ module Selenium
35
35
 
36
36
  autoload :Android, 'selenium/webdriver/android'
37
37
  autoload :Chrome, 'selenium/webdriver/chrome'
38
+ autoload :Edge, 'selenium/webdriver/edge'
38
39
  autoload :Firefox, 'selenium/webdriver/firefox'
39
40
  autoload :IE, 'selenium/webdriver/ie'
40
41
  autoload :IPhone, 'selenium/webdriver/iphone'
@@ -52,7 +53,7 @@ module Selenium
52
53
  #
53
54
  # Create a new Driver instance with the correct bridge for the given browser
54
55
  #
55
- # @param browser [:ie, :internet_explorer, :remote, :chrome, :firefox, :ff, :android, :iphone, :phantomjs, :safari]
56
+ # @param browser [:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :android, :iphone, :phantomjs, :safari]
56
57
  # the driver type to use
57
58
  # @param *rest
58
59
  # arguments passed to Bridge.new
@@ -62,6 +63,7 @@ module Selenium
62
63
  # @see Selenium::WebDriver::Remote::Bridge
63
64
  # @see Selenium::WebDriver::Firefox::Bridge
64
65
  # @see Selenium::WebDriver::IE::Bridge
66
+ # @see Selenium::WebDriver::Edge::Bridge
65
67
  # @see Selenium::WebDriver::Chrome::Bridge
66
68
  # @see Selenium::WebDriver::Android::Bridge
67
69
  # @see Selenium::WebDriver::IPhone::Bridge
@@ -54,6 +54,8 @@ module Selenium
54
54
  IE::Bridge.new(opts)
55
55
  when :chrome
56
56
  Chrome::Bridge.new(opts)
57
+ when :edge
58
+ Edge::Bridge.new(opts)
57
59
  when :android
58
60
  Android::Bridge.new(opts)
59
61
  when :iphone
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Licensed to the Software Freedom Conservancy (SFC) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The SFC licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+
20
+ require 'net/http'
21
+
22
+ require 'selenium/webdriver/edge/service'
23
+ require 'selenium/webdriver/edge/bridge'
24
+
25
+ module Selenium
26
+ module WebDriver
27
+
28
+ module Edge
29
+ def self.driver_path=(path)
30
+ Service.executable_path = path
31
+ end
32
+
33
+ def self.path=(path)
34
+ Platform.assert_executable path
35
+ @path = path
36
+ end
37
+
38
+ def self.path
39
+ @path ||= nil
40
+ end
41
+
42
+ end # Edge
43
+ end # WebDriver
44
+ end # Selenium
@@ -0,0 +1,104 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Licensed to the Software Freedom Conservancy (SFC) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The SFC licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+
20
+ module Selenium
21
+ module WebDriver
22
+ module Edge
23
+
24
+ # @api private
25
+ class Bridge < Remote::Bridge
26
+
27
+ def initialize(opts = {})
28
+ http_client = opts.delete(:http_client)
29
+
30
+ if opts.has_key?(:url)
31
+ url = opts.delete(:url)
32
+ else
33
+ @service = Service.default_service(*extract_service_args(opts))
34
+
35
+ if @service.instance_variable_get("@host") == "127.0.0.1"
36
+ @service.instance_variable_set("@host", 'localhost')
37
+ end
38
+
39
+ @service.start
40
+
41
+ url = @service.uri
42
+ end
43
+
44
+ caps = create_capabilities(opts)
45
+
46
+ remote_opts = {
47
+ :url => url,
48
+ :desired_capabilities => caps
49
+ }
50
+
51
+ remote_opts.merge!(:http_client => http_client) if http_client
52
+ super(remote_opts)
53
+ end
54
+
55
+ def browser
56
+ :edge
57
+ end
58
+
59
+ def driver_extensions
60
+ [
61
+ DriverExtensions::TakesScreenshot,
62
+ DriverExtensions::HasInputDevices
63
+ ]
64
+ end
65
+
66
+ def capabilities
67
+ @capabilities ||= Remote::Capabilities.edge
68
+ end
69
+
70
+ def quit
71
+ super
72
+ ensure
73
+ @service.stop if @service
74
+ end
75
+
76
+ private
77
+
78
+ def create_capabilities(opts)
79
+ caps = opts.delete(:desired_capabilities) { Remote::Capabilities.edge }
80
+ page_load_strategy = opts.delete(:page_load_strategy) || "normal"
81
+
82
+ unless opts.empty?
83
+ raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
84
+ end
85
+
86
+ caps['page_load_strategy'] = page_load_strategy
87
+
88
+ caps
89
+ end
90
+
91
+ def extract_service_args(opts)
92
+ args = []
93
+
94
+ if opts.has_key?(:service_log_path)
95
+ args << "--log-path=#{opts.delete(:service_log_path)}"
96
+ end
97
+
98
+ args
99
+ end
100
+
101
+ end # Bridge
102
+ end # Edge
103
+ end # WebDriver
104
+ end # Selenium
@@ -0,0 +1,120 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Licensed to the Software Freedom Conservancy (SFC) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The SFC licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+
20
+ module Selenium
21
+ module WebDriver
22
+ module Edge
23
+
24
+ #
25
+ # @api private
26
+ #
27
+ class Service
28
+ START_TIMEOUT = 20
29
+ SOCKET_LOCK_TIMEOUT = 45
30
+ STOP_TIMEOUT = 5
31
+ DEFAULT_PORT = 17556
32
+ MISSING_TEXT = "Unable to find MicrosoftWebDriver. Please download the server from https://www.microsoft.com/en-us/download/details.aspx?id=48212. More info at https://github.com/SeleniumHQ/selenium/wiki/MicrosoftWebDriver."
33
+
34
+ def self.executable_path
35
+ @executable_path ||= (
36
+ path = Platform.find_binary "MicrosoftWebDriver"
37
+ path or raise Error::WebDriverError, MISSING_TEXT
38
+ Platform.assert_executable path
39
+
40
+ path
41
+ )
42
+ end
43
+
44
+ def self.executable_path=(path)
45
+ Platform.assert_executable path
46
+ @executable_path = path
47
+ end
48
+
49
+ def self.default_service(*extra_args)
50
+ new executable_path, DEFAULT_PORT, *extra_args
51
+ end
52
+
53
+ def initialize(executable_path, port, *extra_args)
54
+ @executable_path = executable_path
55
+ @host = Platform.localhost
56
+ @port = Integer(port)
57
+
58
+ raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
59
+
60
+ @extra_args = extra_args
61
+ end
62
+
63
+ def start
64
+ Platform.exit_hook { stop } # make sure we don't leave the server running
65
+
66
+ socket_lock.locked do
67
+ find_free_port
68
+ start_process
69
+ connect_until_stable
70
+ end
71
+ end
72
+
73
+ def stop
74
+ return if @process.nil? || @process.exited?
75
+
76
+ Net::HTTP.start(@host, @port) do |http|
77
+ http.open_timeout = STOP_TIMEOUT / 2
78
+ http.read_timeout = STOP_TIMEOUT / 2
79
+
80
+ http.head("/shutdown")
81
+ end
82
+
83
+ @process.poll_for_exit STOP_TIMEOUT
84
+ rescue ChildProcess::TimeoutError
85
+ # ok, force quit
86
+ @process.stop STOP_TIMEOUT
87
+ end
88
+
89
+ def uri
90
+ URI.parse "http://#{@host}:#{@port}"
91
+ end
92
+
93
+ def find_free_port
94
+ @port = PortProber.above @port
95
+ end
96
+
97
+ def start_process
98
+ server_command = [@executable_path, "--port=#{@port}", *@extra_args]
99
+ @process = ChildProcess.build(*server_command)
100
+
101
+ @process.io.inherit! if $DEBUG == true
102
+ @process.start
103
+ end
104
+
105
+ def connect_until_stable
106
+ @socket_poller = SocketPoller.new @host, @port, START_TIMEOUT
107
+
108
+ unless @socket_poller.connected?
109
+ raise Error::WebDriverError, "unable to connect to MicrosoftWebDriver #{@host}:#{@port}"
110
+ end
111
+ end
112
+
113
+ def socket_lock
114
+ @socket_lock ||= SocketLock.new(@port - 1, SOCKET_LOCK_TIMEOUT)
115
+ end
116
+
117
+ end # Service
118
+ end # Edge
119
+ end # WebDriver
120
+ end # Service
@@ -78,6 +78,14 @@ module Selenium
78
78
  }.merge(opts))
79
79
  end
80
80
 
81
+ def edge(opts = {})
82
+ new({
83
+ :browser_name => "edge",
84
+ :platform => :windows,
85
+ :javascript_enabled => true
86
+ }.merge(opts))
87
+ end
88
+
81
89
  def firefox(opts = {})
82
90
  new({
83
91
  :browser_name => "firefox",
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "selenium-webdriver"
10
- s.version = "2.47.0"
10
+ s.version = "2.47.1"
11
11
 
12
12
  s.authors = ["Jari Bakken"]
13
13
  s.email = "jari.bakken@gmail.com"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.47.0
5
+ version: 2.47.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jari Bakken
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2015-07-29 00:00:00 -05:00
13
+ date: 2015-07-31 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -142,6 +142,7 @@ files:
142
142
  - lib/selenium/webdriver/android.rb
143
143
  - lib/selenium/webdriver/chrome.rb
144
144
  - lib/selenium/webdriver/common.rb
145
+ - lib/selenium/webdriver/edge.rb
145
146
  - lib/selenium/webdriver/firefox.rb
146
147
  - lib/selenium/webdriver/ie.rb
147
148
  - lib/selenium/webdriver/iphone.rb
@@ -199,6 +200,8 @@ files:
199
200
  - lib/selenium/webdriver/common/html5/location.rb
200
201
  - lib/selenium/webdriver/common/html5/session_storage.rb
201
202
  - lib/selenium/webdriver/common/html5/shared_web_storage.rb
203
+ - lib/selenium/webdriver/edge/bridge.rb
204
+ - lib/selenium/webdriver/edge/service.rb
202
205
  - lib/selenium/webdriver/firefox/binary.rb
203
206
  - lib/selenium/webdriver/firefox/bridge.rb
204
207
  - lib/selenium/webdriver/firefox/extension.rb