Add key value headers with Selenium c#

Viewed 198

I am trying to add key value header before opening browser with ChromeDriver. In order to add the headers not through code I use the browser extension called ModHeader https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj?hl=en

I tried the following code:

        ChromeOptions options = new ChromeOptions();
        options.AddAdditionalOption("key", "value");
        driver = new ChromeDriver(@"C:\Program Files\chromedriver_win32",options);
        driver.Url="https://someSite.com"

But this did not add the header. Thank you

1 Answers

I found a solution to add a header

AddHeadersToBrowser.addHeaders(driver ,"{Key}", "{Value}");
Related