Skip to content

Commit 63e6cce

Browse files
committed
Safari driver supports /status endpoint
1 parent 6da3095 commit 63e6cce

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

dotnet/src/webdriver/Safari/SafariDriverService.cs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -87,56 +87,6 @@ protected override bool HasShutdown
8787
get { return false; }
8888
}
8989

90-
/// <summary>
91-
/// Gets a value indicating whether the service is responding to HTTP requests.
92-
/// </summary>
93-
protected override bool IsInitialized
94-
{
95-
get
96-
{
97-
bool isInitialized = false;
98-
99-
Uri serviceHealthUri = new Uri(this.ServiceUrl, new Uri("/session/FakeSessionIdForPollingPurposes", UriKind.Relative));
100-
101-
// Since Firefox driver won't implement the /session end point (because
102-
// the W3C spec working group stupidly decided that it isn't necessary),
103-
// we'll attempt to poll for a different URL which has no side effects.
104-
// We've chosen to poll on the "quit" URL, passing in a nonexistent
105-
// session id.
106-
using (var httpClient = new HttpClient())
107-
{
108-
httpClient.DefaultRequestHeaders.ConnectionClose = true;
109-
httpClient.Timeout = TimeSpan.FromSeconds(5);
110-
111-
using (var httpRequest = new HttpRequestMessage(HttpMethod.Delete, serviceHealthUri))
112-
{
113-
try
114-
{
115-
using (var httpResponse = Task.Run(async () => await httpClient.SendAsync(httpRequest)).GetAwaiter().GetResult())
116-
{
117-
isInitialized = (httpResponse.StatusCode == HttpStatusCode.OK
118-
|| httpResponse.StatusCode == HttpStatusCode.InternalServerError
119-
|| httpResponse.StatusCode == HttpStatusCode.NotFound)
120-
&& httpResponse.Content.Headers.ContentType.MediaType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase);
121-
}
122-
}
123-
124-
// Checking the response from deleting a nonexistent session. Note that we are simply
125-
// checking that the HTTP status returned is a 200 status, and that the resposne has
126-
// the correct Content-Type header. A more sophisticated check would parse the JSON
127-
// response and validate its values. At the moment we do not do this more sophisticated
128-
// check.
129-
catch (Exception ex) when (ex is HttpRequestException || ex is TaskCanceledException)
130-
{
131-
// Do nothing. The exception is expected, meaning driver service is not initialized.
132-
}
133-
}
134-
}
135-
136-
return isInitialized;
137-
}
138-
}
139-
14090
/// <summary>
14191
/// Creates a default instance of the SafariDriverService.
14292
/// </summary>

0 commit comments

Comments
 (0)