Description
Currently:
var options = new ChromeOptions();
options.AddArgument("--a");
options.UseWebSocketUrl = true;
var chrome = new ChromeDriver(options);
Have you considered any alternatives or workarounds?
var chrome = new ChromeDriver(hd =>
{
hd.AddArguments("--a").UseWebSockeUrl();
});
Why:
Currently there are so many constructor overloads. And even all of them don't cover everything what it can opt-in. To specify commandTimeout I should use some constructor where commandTimeout is last argument. If we will support one more argument, then we should duplicate all constructors.
Conceptually, any WebDriver is:
- DriverService (chromedriver.exe)
- Browser options (Capabilities?)
- HTTP client (transport)
WebDriverBuilder will be single entry point, allowing:
- Fluently describe what driver to start
- Configure driver service (even to be reusable if user wants)
- Configure HTTP low-level client
Pseudo example:
var chrome = new ChromeDriver(hd =>
{
hd.WithVersion("145.1").
.WithService(s => s.UseFeatureA().UseFeatureB()) // or .WithService(_myExistingService)
.WithHttp(h => { h.DefaultHeaders.Add("x-name", "john"); h.UseProxy = false } );
});
Description
Currently:
Have you considered any alternatives or workarounds?
Why:
Currently there are so many constructor overloads. And even all of them don't cover everything what it can opt-in. To specify
commandTimeoutI should use some constructor wherecommandTimeoutis last argument. If we will support one more argument, then we should duplicate all constructors.Conceptually, any WebDriver is:
WebDriverBuilder will be single entry point, allowing:
Pseudo example: