selenium_surfer 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,10 +9,11 @@ module SeleniumSurfer
9
9
 
10
10
  attr_reader :session_id
11
11
 
12
- def initialize(_session_id, _anonymous)
12
+ def initialize(_session_id, _anonymous, _caps)
13
13
  @session_id = _session_id
14
14
  @bound_ctx = nil
15
15
  @anonymous = _anonymous
16
+ @caps = _caps
16
17
  end
17
18
 
18
19
  # get the current driver instance, reset it if required
@@ -27,13 +28,18 @@ module SeleniumSurfer
27
28
 
28
29
  case driver_name.to_sym
29
30
  when :remote
31
+ # select capabilities object
32
+ caps = SeleniumSurfer.config[:capabilities]
33
+ caps = @caps if @caps
34
+ caps = Selenium::WebDriver::Remote::Capabilities.firefox if caps.nil?
35
+
30
36
  url = SeleniumSurfer.config[:remote_host]
31
37
 
32
38
  # setup a custom client to use longer timeouts
33
39
  client = Selenium::WebDriver::Remote::Http::Default.new
34
40
  client.timeout = SeleniumSurfer.config[:remote_timeout]
35
41
 
36
- @driver = Selenium::WebDriver.for :remote, :url => url, :http_client => client
42
+ @driver = Selenium::WebDriver.for :remote, :url => url, :http_client => client, :desired_capabilities => caps
37
43
  else
38
44
  @driver = Selenium::WebDriver.for driver_name.to_sym
39
45
 
@@ -73,10 +73,10 @@ module SeleniumSurfer
73
73
 
74
74
  if _session.nil? and not @@block_options.fetch(:nil_sessions, false)
75
75
  # create an anonymous bucket
76
- bucket = DriverBucket.new nil, true
76
+ bucket = DriverBucket.new nil, true, _opt[:driver_capabilities]
77
77
  else
78
78
  bucket = @@all_buckets[_session]
79
- bucket = @@all_buckets[_session] = DriverBucket.new _session, false if bucket.nil?
79
+ bucket = @@all_buckets[_session] = DriverBucket.new _session, false, _opt[:driver_capabilities] if bucket.nil?
80
80
  raise SetupError.new 'session already bound' if bucket.bound?
81
81
  end
82
82
 
@@ -1,3 +1,3 @@
1
1
  module SeleniumSurfer
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ignacio Baixas
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-10-24 00:00:00 -03:00
17
+ date: 2013-11-14 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency