Skip to content

Commit a98eafd

Browse files
authored
Merge branch 'trunk' into add_response_handler
2 parents 3ac73c1 + 013443d commit a98eafd

File tree

2 files changed

+1
-53
lines changed

2 files changed

+1
-53
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>

dotnet/src/webdriver/assets/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ Selenium is a set of different software tools each with a different approach to
66
using OpenQA.Selenium.Chrome;
77
using OpenQA.Selenium;
88

9-
var driver = new ChromeDriver();
9+
using var driver = new ChromeDriver();
1010

1111
driver.Url = "https://www.google.com";
1212
driver.FindElement(By.Name("q")).SendKeys("webdriver" + Keys.Return);
1313
Console.WriteLine(driver.Title);
14-
15-
driver.Quit();
1614
```
1715

1816
# Contributing

0 commit comments

Comments
 (0)