Class: Selenium::WebDriver::Firefox::Launcher Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Firefox::Launcher
- Defined in:
- rb/lib/selenium/webdriver/firefox/launcher.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary
- SOCKET_LOCK_TIMEOUT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
45
- STABLE_CONNECTION_TIMEOUT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
60
Instance Method Summary (collapse)
- - (Object) assert_profile private
- - (Object) connect_until_stable private
- - (Object) create_profile private
- - (Object) fetch_profile private
- - (Object) find_free_port private
-
- (Launcher) initialize(binary, port, profile = nil)
constructor
private
A new instance of Launcher.
- - (Object) launch private
- - (Object) quit private
- - (Object) socket_lock private
- - (Object) start private
- - (Object) start_silent_and_wait private
- - (Object) url private
Constructor Details
- (Launcher) initialize(binary, port, profile = nil)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Launcher
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 11 def initialize(binary, port, profile = nil) @binary = binary @port = Integer(port) raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1 if profile.kind_of? Profile @profile = profile else @profile_name = profile @profile = nil end @host = "127.0.0.1" end |
Instance Method Details
- (Object) assert_profile
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
95 96 97 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 95 def assert_profile raise Error::WebDriverError, "must create_profile first" unless @profile && @profile_dir end |
- (Object) connect_until_stable
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
74 75 76 77 78 79 80 81 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 74 def connect_until_stable poller = SocketPoller.new(@host, @port, STABLE_CONNECTION_TIMEOUT) unless poller.connected? @binary.quit raise Error::WebDriverError, "unable to obtain stable firefox connection in #{STABLE_CONNECTION_TIMEOUT} seconds (#{@host}:#{@port})" end end |
- (Object) create_profile
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
52 53 54 55 56 57 58 59 60 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 52 def create_profile fetch_profile unless @profile @profile.add_webdriver_extension @profile.port = @port @profile_dir = @profile.layout_on_disk FileReaper << @profile_dir end |
- (Object) fetch_profile
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
83 84 85 86 87 88 89 90 91 92 93 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 83 def fetch_profile if @profile_name @profile = Profile.from_name @profile_name unless @profile raise Error::WebDriverError, "unable to find profile named: #{@profile_name.inspect}" end else @profile = Profile.new end end |
- (Object) find_free_port
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 48 def find_free_port @port = PortProber.above @port end |
- (Object) launch
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 31 def launch socket_lock.locked do find_free_port create_profile start_silent_and_wait start connect_until_stable end self end |
- (Object) quit
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 46 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 43 def quit @binary.quit FileReaper.reap(@profile_dir) if @profile_dir end |
- (Object) socket_lock
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
99 100 101 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 99 def socket_lock @socket_lock ||= SocketLock.new(@port - 1, SOCKET_LOCK_TIMEOUT) end |
- (Object) start
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
62 63 64 65 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 62 def start assert_profile @binary.start_with @profile, @profile_dir, "-foreground" end |
- (Object) start_silent_and_wait
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 70 71 72 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 67 def start_silent_and_wait assert_profile @binary.start_with @profile, @profile_dir, "-silent" @binary.wait end |
- (Object) url
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'rb/lib/selenium/webdriver/firefox/launcher.rb', line 27 def url "http://#{@host}:#{@port}/hub" end |