selenium-phantomjs 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7472d3680be5b6fad11feef0321c7afcfd5a8b7
4
- data.tar.gz: 3d8d65f998265f65fe3709ca8243d5624d7ee8ea
3
+ metadata.gz: 399d9a7b39e518ecb54ba1a141d09875aa72dbe1
4
+ data.tar.gz: 6a8a91f502e4d00df1d5abdc52932f0abcc25259
5
5
  SHA512:
6
- metadata.gz: 4ae4d4d5be1c741bdf030aa076681d52c4631674486121e272cf421a3e2e71a96483ad39e3453017c864369b8b77fa18579bf3a1f263ad2ab78d12ad2e6a07c3
7
- data.tar.gz: 9c5d225d0c8725bf328a564dce3b8014d5dd03244f1691e54eece60e709e83e25a696edb632843fd85be14c22e97a01af4cc314511a5de6ff8322ba0b984c0cf
6
+ metadata.gz: f649082aa23cbbe57a9a32b091899f616e782e7f1496db1b0981c5d1d700d8abde268693749c0eccc67b92cc193938661539b092b07bf2e4bcfe78eea79f9cb3
7
+ data.tar.gz: c1206d3b34bbc4275879f07fef1db5f37989c9f85bcf779a86a276344dbca66079de0087fc2b283ef60c66999495211051698737d1027fde0fc28bd4c83ec2e9
data/README.md CHANGED
@@ -24,7 +24,18 @@ To use PhantomJS as a browser for Selenium test just add to your ```spec_helper.
24
24
  Capybara.default_driver = :selenium_phantomjs
25
25
  ```
26
26
 
27
- Please note that Ghostdriver needs [Selenium Hub](https://code.google.com/p/selenium/wiki/Grid2) to run at ```localhost:4444```.
27
+ Please note that Ghostdriver needs [Selenium Hub](https://code.google.com/p/selenium/wiki/Grid2) run on ```localhost:4444```.
28
+
29
+ ## How to pass startup args to PhantomJS
30
+
31
+ If you want to pass command line args to the phantmojs binary by startup you
32
+ can:
33
+
34
+ ```ruby
35
+ Selenium::Phantomjs.start(:proxy => 'localhost:45678')
36
+ ```
37
+
38
+ This will start a Phantomjs instance with `--proxy="localhost:45678"` argument
28
39
 
29
40
  ## Contributing
30
41
 
@@ -4,18 +4,22 @@ require 'selenium/phantomjs/version'
4
4
  require 'selenium/phantomjs/instance'
5
5
  require 'selenium/phantomjs/web_driver'
6
6
 
7
- Selenium::Phantomjs::WebDriver.new('tmp/pids/phantomjs.pid').run
8
-
9
7
  module Selenium
10
8
  module Phantomjs
11
9
  extend self
12
10
 
11
+ def start(args = {})
12
+ WebDriver.new('tmp/pids/phantomjs.pid').run(args)
13
+ end
14
+
13
15
  def register_driver
14
16
  begin
15
17
  require 'selenium/webdriver'
16
18
  rescue LoadError
17
19
  end
18
20
 
21
+ Phantomjs.start
22
+
19
23
  if defined? Selenium::WebDriver
20
24
  Capybara.register_driver :selenium_phantomjs do |app|
21
25
  Capybara::Selenium::Driver.new(app, options)
@@ -25,8 +29,8 @@ module Selenium
25
29
 
26
30
  def options
27
31
  {
28
- browser: :remote,
29
- url: "#{WebDriver::SELENIUM_GRID_URL}/wd/hub",
32
+ browser: :remote,
33
+ url: "#{WebDriver::SELENIUM_GRID_URL}/wd/hub",
30
34
  desired_capabilities: {
31
35
  browserName: :phantomjs
32
36
  }
@@ -1,5 +1,5 @@
1
1
  module Selenium
2
2
  module Phantomjs
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -5,12 +5,13 @@ module Selenium
5
5
  LOGLEVEL = 'WARN'.freeze
6
6
  SELENIUM_GRID_URL = "http://#{Selenium::WebDriver::Platform.localhost}:4444".freeze
7
7
 
8
- def run(options = {[:out, :err] => [LOG, 'a']})
9
- super({
10
- :wd => nil,
11
- :'webdriver-selenium-grid-hub' => SELENIUM_GRID_URL,
8
+ def run(args = {}, options = {[:out, :err] => [LOG, 'a']})
9
+ phantomjs_args = {
10
+ :'webdriver-selenium-grid-hub' => SELENIUM_GRID_URL,
12
11
  :'webdriver-loglevel' => LOGLEVEL
13
- }, options)
12
+ }.merge(args).merge(wd: nil)
13
+
14
+ super(phantomjs_args, options)
14
15
  end
15
16
  end
16
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-phantomjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Slotin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-07 00:00:00.000000000 Z
11
+ date: 2013-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler