You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding BeforeRemoteHttpRequest event to .NET RemoteWebDriver
This commit adds the ability for advanced users of the .NET bindings
RemoteWebDriver class to modify the HTTP command sent from the .NET
WebDriver code to the remote WebDriver server. Note carefully that this
**DOES NOT** modify the HTTP request between the browser and the web
server, and is not a mechanism for getting access to that HTTP request.
Usage of this new event would look something like this:
public void StartDriver()
{
HttpCommandExecutor executor = new HttpCommandExecutor(
new Url("http://localhost:4444/wd/hub"), TimeSpan.FromSeconds(60));
executor.BeforeRemoteHttpRequest += BeforeRemoteHttpRequestHandler;
ICapabilities capabilities = new ChromeOptions().ToCapabilities();
IWebDriver driver = new RemoteWebDriver(executor, capabilities);
}
public void BeforeRemoteHttpRequestHandler(
object sender, BeforeRemoteHttpRequestEventArgs e)
{
// Note: WebRequest.DefaultWebProxy is an IWebProxy implementation.
// This could be anything, from adding additional headers, to modifying
// the content of the request. Use with extreme caution.
e.Request.Proxy = WebRequest.DefaultWebProxy;
e.Request.AutomaticDecompression = DecompressionMethods.GZip
}
0 commit comments