florentbr / SeleniumBasic

A Selenium based browser automation framework for VB.Net, VBA and VBScript
BSD 3-Clause "New" or "Revised" License
433 stars 198 forks source link

Extra HTTP header to requests #244

Open uhnju opened 2 years ago

uhnju commented 2 years ago

It is possible to add an extra HTTP header to requests with Selenium Basic?

In Selenium 4 is possible with DevTools:

    DevTools devTools = ((HasDevTools)driver).getDevTools();
    Map<String, Object> headers = new HashMap<>();
    headers.put("EXTRA_HEADER", "DEV_TOOLS");
    devTools.createSession();
    devTools.send(Network.enable(Optional.empty(), Optional.empty(), Optional.empty()));
    devTools.send(Network.setExtraHTTPHeaders(new Headers(headers)));

https://www.selenium.dev/documentation/webdriver/bidirectional/chrome_devtools/

Thanks a lot!