selenium-webdriver 2.30.0 → 2.31.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,28 @@
1
+ 2.31.0 (2013-03-02)
2
+ ===================
3
+
4
+ Remote:
5
+ * Expose session_id on the remote driver when used directly (#5240).
6
+ Firefox:
7
+ * Native events in Firefox 19
8
+ Opera:
9
+ * Treat UNSPECIFIED proxy type as a nil proxy (#5081).
10
+ Other:
11
+ * Add ability to pass :desired_capabilities to all the Ruby drivers, not just for :remote.
12
+ Direct arguments take presendence. (#5078, see also https://github.com/SeleniumHQ/selenium/pull/8, https://github.com/SeleniumHQ/selenium/pull/11)
13
+
14
+ 2.30.0 (2013-02-20)
15
+ ===================
16
+
17
+ Firefox:
18
+ * Firefox 19 support (for synthesized events)
19
+ Remote:
20
+ * Pass along firefox_binary correctly (#5152)
21
+ Safari:
22
+ * Don't overwrite Driver#browser
23
+ Other
24
+ * Alert#text should raise on closed alert.
25
+
1
26
  2.29.0 (2013-01-21)
2
27
  ===================
3
28
 
@@ -45,7 +70,7 @@ Firefox:
45
70
  * FIXED: 4165: WebDriver fails on a machine with no IP address.
46
71
  Safari:
47
72
  * Fixed SafariDriver to allow calling .quit() consecutively without error.
48
- * FIXED: 4676: Unable to fire javascript events into SVG's.
73
+ * FIXED: 4676: Unable to fire javascript events into SVG's.
49
74
  * FIXED: 3969: SafariDriver should auto-dismiss alerts.
50
75
  IE:
51
76
  * FIXED: 4535: Hover still does not work perfectly in IE.
@@ -53,6 +53,7 @@ module Selenium
53
53
  private
54
54
 
55
55
  def create_capabilities(opts)
56
+ caps = opts.delete(:desired_capabilities) { Remote::Capabilities.chrome }
56
57
  args = opts.delete(:args) || opts.delete(:switches)
57
58
  native_events = opts.delete(:native_events)
58
59
  verbose = opts.delete(:verbose)
@@ -65,7 +66,7 @@ module Selenium
65
66
  raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
66
67
  end
67
68
 
68
- chrome_options = {}
69
+ chrome_options = caps['chromeOptions'] || {}
69
70
 
70
71
  if args
71
72
  unless args.kind_of? Array
@@ -89,7 +90,6 @@ module Selenium
89
90
  chrome_options['detach'] = detach.nil? || !!detach
90
91
  chrome_options['noWebsiteTestingDefaults'] = true if no_website_testing_defaults
91
92
 
92
- caps = Remote::Capabilities.chrome
93
93
  caps['chromeOptions'] = chrome_options
94
94
  caps['proxy'] = proxy if proxy
95
95
 
@@ -31,6 +31,7 @@ require 'selenium/webdriver/common/driver_extensions/has_browser_connection'
31
31
  require 'selenium/webdriver/common/driver_extensions/has_input_devices'
32
32
  require 'selenium/webdriver/common/driver_extensions/has_web_storage'
33
33
  require 'selenium/webdriver/common/driver_extensions/has_location'
34
+ require 'selenium/webdriver/common/driver_extensions/has_session_id'
34
35
  require 'selenium/webdriver/common/driver_extensions/has_touch_screen'
35
36
  require 'selenium/webdriver/common/driver_extensions/uploads_files'
36
37
  require 'selenium/webdriver/common/keys'
@@ -0,0 +1,22 @@
1
+ module Selenium
2
+ module WebDriver
3
+
4
+ #
5
+ # @api private
6
+ #
7
+
8
+ module DriverExtensions
9
+ module HasSessionId
10
+
11
+ #
12
+ # @return [String] the session id
13
+ # @api public
14
+ #
15
+
16
+ def session_id
17
+ @bridge.session_id
18
+ end
19
+ end # HasSessionId
20
+ end # DriverExtensions
21
+ end # WebDriver
22
+ end # Selenium
@@ -88,6 +88,16 @@ module Selenium
88
88
  !!(RUBY_PLATFORM =~ /cygwin/)
89
89
  end
90
90
 
91
+ def null_device
92
+ @null_device ||= (
93
+ if defined?(File::NULL)
94
+ File::NULL
95
+ else
96
+ Platform.windows? ? 'NUL' : '/dev/null'
97
+ end
98
+ )
99
+ end
100
+
91
101
  def wrap_in_quotes_if_necessary(str)
92
102
  windows? && !cygwin? ? %{"#{str}"} : str
93
103
  end
@@ -177,15 +187,16 @@ module Selenium
177
187
  end # Selenium
178
188
 
179
189
  if __FILE__ == $0
180
- p :engine => Selenium::WebDriver::Platform.engine,
181
- :os => Selenium::WebDriver::Platform.os,
182
- :ruby187? => Selenium::WebDriver::Platform.ruby187?,
183
- :ruby19? => Selenium::WebDriver::Platform.ruby19?,
184
- :jruby? => Selenium::WebDriver::Platform.jruby?,
185
- :windows? => Selenium::WebDriver::Platform.windows?,
186
- :home => Selenium::WebDriver::Platform.home,
187
- :bitsize => Selenium::WebDriver::Platform.bitsize,
188
- :localhost => Selenium::WebDriver::Platform.localhost,
189
- :ip => Selenium::WebDriver::Platform.ip,
190
- :interfaces => Selenium::WebDriver::Platform.interfaces
190
+ p :engine => Selenium::WebDriver::Platform.engine,
191
+ :os => Selenium::WebDriver::Platform.os,
192
+ :ruby187? => Selenium::WebDriver::Platform.ruby187?,
193
+ :ruby19? => Selenium::WebDriver::Platform.ruby19?,
194
+ :jruby? => Selenium::WebDriver::Platform.jruby?,
195
+ :windows? => Selenium::WebDriver::Platform.windows?,
196
+ :home => Selenium::WebDriver::Platform.home,
197
+ :bitsize => Selenium::WebDriver::Platform.bitsize,
198
+ :localhost => Selenium::WebDriver::Platform.localhost,
199
+ :ip => Selenium::WebDriver::Platform.ip,
200
+ :interfaces => Selenium::WebDriver::Platform.interfaces,
201
+ :null_device => Selenium::WebDriver::Platform.null_device
191
202
  end
@@ -101,6 +101,8 @@ module Selenium
101
101
 
102
102
  class << self
103
103
  def json_create(data)
104
+ return if data['proxyType'] == 'UNSPECIFIED'
105
+
104
106
  proxy = new
105
107
 
106
108
  proxy.type = data['proxyType'].downcase.to_sym if data.has_key? 'proxyType'
@@ -11,7 +11,11 @@ module Selenium
11
11
  http_client = opts.delete(:http_client)
12
12
  proxy = opts.delete(:proxy)
13
13
 
14
- @launcher = create_launcher(port, profile)
14
+ caps = opts.delete(:desired_capabilities) do
15
+ Remote::Capabilities.firefox(:native_events => DEFAULT_ENABLE_NATIVE_EVENTS)
16
+ end
17
+
18
+ @launcher = create_launcher(port, profile)
15
19
 
16
20
  unless opts.empty?
17
21
  raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
@@ -19,7 +23,6 @@ module Selenium
19
23
 
20
24
  @launcher.launch
21
25
 
22
- caps = Remote::Capabilities.firefox(:native_events => DEFAULT_ENABLE_NATIVE_EVENTS)
23
26
  caps.proxy = proxy if proxy
24
27
 
25
28
  remote_opts = {
@@ -13,6 +13,7 @@ module Selenium
13
13
  DEFAULT_TIMEOUT = 30
14
14
 
15
15
  def initialize(opts = {})
16
+ caps = opts.delete(:desired_capabilities) { Remote::Capabilities.internet_explorer }
16
17
  timeout = opts.delete(:timeout) { DEFAULT_TIMEOUT }
17
18
  port = opts.delete(:port) { PortProber.above(DEFAULT_PORT) }
18
19
  http_client = opts.delete(:http_client)
@@ -20,7 +21,7 @@ module Selenium
20
21
  native_events = opts.delete(:native_events) != false
21
22
 
22
23
  @server = Server.get
23
-
24
+
24
25
  @server.log_level = opts.delete(:log_level) if opts[:log_level]
25
26
  @server.log_file = opts.delete(:log_file) if opts[:log_file]
26
27
 
@@ -30,7 +31,6 @@ module Selenium
30
31
 
31
32
  @port = @server.start Integer(port), timeout
32
33
 
33
- caps = Remote::Capabilities.internet_explorer
34
34
  if ignore_mode
35
35
  caps['ignoreProtectedModeSettings'] = true
36
36
  end
@@ -2,23 +2,26 @@ module Selenium
2
2
  module WebDriver
3
3
  module PhantomJS
4
4
 
5
+
5
6
  # @api private
6
7
  class Bridge < Remote::Bridge
7
8
 
8
9
  def initialize(opts = {})
9
10
  http_client = opts.delete(:http_client)
11
+ caps = opts.delete(:desired_capabilities) { Remote::Capabilities.phantomjs }
10
12
 
11
13
  if opts.has_key?(:url)
12
14
  url = opts.delete(:url)
13
15
  else
14
- @service = Service.default_service
15
- @service.start
16
+ args = opts.delete(:args) || caps['phantomjs.cli.args']
17
+ port = opts.delete(:port)
18
+
19
+ @service = Service.default_service(port)
20
+ @service.start(args)
16
21
 
17
22
  url = @service.uri
18
23
  end
19
24
 
20
- caps = Remote::Capabilities.phantomjs
21
-
22
25
  remote_opts = {
23
26
  :url => url,
24
27
  :desired_capabilities => caps
@@ -24,24 +24,26 @@ module Selenium
24
24
  )
25
25
  end
26
26
 
27
- def self.default_service
28
- new executable_path, PortProber.above(DEFAULT_PORT)
27
+ def self.default_service(port = nil)
28
+ new executable_path, port || PortProber.above(DEFAULT_PORT)
29
29
  end
30
30
 
31
31
  def initialize(executable_path, port)
32
- @uri = URI.parse "http://#{Platform.localhost}:#{port}"
33
- server_command = [executable_path, "--webdriver=#{port}"]
34
-
35
- @process = ChildProcess.build(*server_command)
36
- @socket_poller = SocketPoller.new Platform.localhost, port, START_TIMEOUT
37
-
38
- @process.io.inherit! if $DEBUG == true
32
+ @uri = URI.parse "http://#{Platform.localhost}:#{port}"
33
+ @executable = executable_path
39
34
  end
40
35
 
41
- def start
36
+ def start(args = [])
37
+ if @process && @process.alive?
38
+ raise "already started: #{@uri.inspect} #{@executable.inspect}"
39
+ end
40
+
41
+ @process = create_process(args)
42
42
  @process.start
43
43
 
44
- unless @socket_poller.connected?
44
+ socket_poller = SocketPoller.new Platform.localhost, @uri.port, START_TIMEOUT
45
+
46
+ unless socket_poller.connected?
45
47
  raise Error::WebDriverError, "unable to connect to phantomjs @ #{@uri} after #{START_TIMEOUT} seconds"
46
48
  end
47
49
 
@@ -62,9 +64,27 @@ module Selenium
62
64
  rescue ChildProcess::TimeoutError
63
65
  # ok, force quit
64
66
  @process.stop STOP_TIMEOUT
67
+
68
+ if Platform.jruby? && !$DEBUG
69
+ @process.io.close rescue nil
70
+ end
65
71
  end
66
- end # Service
67
72
 
73
+ def create_process(args)
74
+ server_command = [@executable, "--webdriver=#{@uri.port}", *args]
75
+ process = ChildProcess.build(*server_command.compact)
76
+
77
+ if $DEBUG == true
78
+ process.io.inherit!
79
+ elsif Platform.jruby?
80
+ # apparently we need to read the output for phantomjs to work on jruby
81
+ process.io.stdout = process.io.stderr = File.new(Platform.null_device, 'w')
82
+ end
83
+
84
+ process
85
+ end
86
+
87
+ end # Service
68
88
  end # PhantomJS
69
89
  end # WebDriver
70
90
  end # Service
@@ -76,7 +76,8 @@ module Selenium
76
76
  [
77
77
  DriverExtensions::HasInputDevices,
78
78
  DriverExtensions::UploadsFiles,
79
- DriverExtensions::TakesScreenshot
79
+ DriverExtensions::TakesScreenshot,
80
+ DriverExtensions::HasSessionId
80
81
  ]
81
82
  end
82
83
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.30.0
5
+ version: 2.31.0
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: 2013-02-20 00:00:00 +01:00
13
+ date: 2013-03-02 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -175,6 +175,7 @@ files:
175
175
  - lib/selenium/webdriver/common/driver_extensions/has_browser_connection.rb
176
176
  - lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb
177
177
  - lib/selenium/webdriver/common/driver_extensions/has_location.rb
178
+ - lib/selenium/webdriver/common/driver_extensions/has_session_id.rb
178
179
  - lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb
179
180
  - lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb
180
181
  - lib/selenium/webdriver/common/driver_extensions/rotatable.rb