File tree Expand file tree Collapse file tree 5 files changed +22
-24
lines changed
rb/lib/selenium/webdriver Expand file tree Collapse file tree 5 files changed +22
-24
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,8 @@ def stop_server
57
57
connect_to_server { |http | http . get ( "/shutdown" ) }
58
58
end
59
59
60
- def connect_until_stable
61
- socket_poller = SocketPoller . new @host , @port , START_TIMEOUT
62
-
63
- unless socket_poller . connected?
64
- raise Error ::WebDriverError , "unable to connect to chromedriver #{ @host } :#{ @port } "
65
- end
60
+ def cannot_connect_error_text
61
+ "unable to connect to chromedriver #{ @host } :#{ @port } "
66
62
end
67
63
68
64
end # Service
Original file line number Diff line number Diff line change 20
20
module Selenium
21
21
module WebDriver
22
22
23
+ #
24
+ # Base class implementing default behavior of service object,
25
+ # responsible for starting and stopping driver implementations.
26
+ #
27
+ # Subclasses must implement the following private methods:
28
+ # * #start_process
29
+ # * #stop_server
30
+ # * #cannot_connect_error_text
23
31
#
24
32
# @api private
25
33
#
@@ -99,6 +107,12 @@ def stop_process
99
107
end
100
108
101
109
def connect_until_stable
110
+ socket_poller = SocketPoller . new @host , @port , START_TIMEOUT
111
+ return if socket_poller . connected?
112
+ raise Error ::WebDriverError , cannot_connect_error_text
113
+ end
114
+
115
+ def cannot_connect_error_text
102
116
raise NotImplementedError , "subclass responsibility"
103
117
end
104
118
Original file line number Diff line number Diff line change @@ -57,12 +57,8 @@ def start_process
57
57
@process . start
58
58
end
59
59
60
- def connect_until_stable
61
- socket_poller = SocketPoller . new @host , @port , START_TIMEOUT
62
-
63
- unless socket_poller . connected?
64
- raise Error ::WebDriverError , "unable to connect to MicrosoftWebDriver #{ @host } :#{ @port } "
65
- end
60
+ def cannot_connect_error_text
61
+ "unable to connect to MicrosoftWebDriver #{ @host } :#{ @port } "
66
62
end
67
63
68
64
end # Service
Original file line number Diff line number Diff line change @@ -71,12 +71,8 @@ def stop_server
71
71
connect_to_server { |http | http . head ( "/shutdown" ) }
72
72
end
73
73
74
- def connect_until_stable
75
- @socket_poller = SocketPoller . new @host , @port , START_TIMEOUT
76
-
77
- unless @socket_poller . connected?
78
- raise Error ::WebDriverError , "unable to connect to Mozilla Wires #{ @host } :#{ @port } "
79
- end
74
+ def cannot_connect_error_text
75
+ "unable to connect to Mozilla Wires #{ @host } :#{ @port } "
80
76
end
81
77
82
78
end # Service
Original file line number Diff line number Diff line change @@ -70,12 +70,8 @@ def stop_server
70
70
connect_to_server { |http | http . get ( "/shutdown" ) }
71
71
end
72
72
73
- def connect_until_stable
74
- socket_poller = SocketPoller . new @host , @port , START_TIMEOUT
75
-
76
- unless socket_poller . connected?
77
- raise Error ::WebDriverError , "unable to connect to phantomjs @ #{ uri } after #{ START_TIMEOUT } seconds"
78
- end
73
+ def cannot_connect_error_text
74
+ "unable to connect to phantomjs @ #{ uri } after #{ START_TIMEOUT } seconds"
79
75
end
80
76
81
77
end # Service
You can’t perform that action at this time.
0 commit comments