SeleniumBasic icon indicating copy to clipboard operation
SeleniumBasic copied to clipboard

Extra HTTP header to requests

Open uhnju opened this issue 2 years ago • 0 comments

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!

uhnju avatar Feb 28 '22 08:02 uhnju