Open TricTracT opened 9 months ago
Hi @TricTracT , it sounds like you are able to reach the Edge WebDriver server when launching it manually and then connecting to it through a simple script.
From a quick glance at the Selenium source code, it looks like the problem you are seeing, "Cannot start the driver service on ###", is logged when the driver process never even starts:
Some policy may be preventing Selenium from launching the driver process on the affected server.
Hi @bwalderman,
Thanks for your reply. The thing is, selenium is actually launching the webdriver and from visual studio it is reachable through a powershell script (by using the developer powershell console) and by using the webbrowser. I am using the same check as selenium does in the driverservice. So somehow selenium is not able to reach the service on localhost, but the powershell script (which is also ran from visual studio) is able to reach it.
So what would be the difference in policies that might affect selenium, but does not affect powershell?
So what the webdriver does is this check:
Uri serviceHealthUri = new Uri(this.ServiceUrl, new Uri(DriverCommand.Status, UriKind.Relative));
using (var response = Task.Run(async () => await httpClient.GetAsync(serviceHealthUri)).GetAwaiter().GetResult())
{
// Checking the response from the 'status' end point. Note that we are simply checking
// that the HTTP status returned is a 200 status, and that the resposne has the correct
// Content-Type header. A more sophisticated check would parse the JSON response and
// validate its values. At the moment we do not do this more sophisticated check.
isInitialized = response.StatusCode == HttpStatusCode.OK && response.Content.Headers.ContentType.MediaType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase);
}
That HTTP 200 check I've build in powershell and when I execute it at the moment the test is running (and I see the webdriver is started) it gets an HTTP 200 back. Whilst the test in VS crashes moments later (+/- 5 seconds) with the error that it cannot start the driver service. But it did start :-(
We have a testautomation framework which is working fine on my own system. It uses drivermanager to fetch the right version of msedgedriver.exe and then is supposed to launch edge and starts testing with the scripts. This works fine on my own laptop.
This code is now on a server of a client of mine. The server has Windows Server 2019 installed and is behind a proxy.The user has local administrator rights. On this server, when I launch a test with VS 2022 msedgedriver.exe starts (taskmanager) but the test fails:
The msedgedriver.exe is reachable through edge on http://localhost:53325/ (or any other port it starts) but Edge itself never starts.
The code used to start:
What we've already tried:
namespace SeleniumTestProject { public class BlankSeleniumTest {
}
Set the URL for the WebDriver service status check
$serviceUrl = "http://localhost:5588/status"
Attempt to make an HTTP GET request to the service URL
try { $response = Invoke-WebRequest -Uri $serviceUrl -TimeoutSec 5
} catch { Write-Host "Error: $_" }
echo $response.StatusCode
WebDriver service is running and responsive. 200