Created
July 3, 2019 13:08
-
-
Save adiohana/4c3065fe56e2168d2aa3afeef9bf3589 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void addCustomHeaders() { | |
//enable Network | |
chromeDevTools.send(Network.enable(Optional.empty(), Optional.empty(), Optional.empty())); | |
//set custom header | |
chromeDevTools.send(Network.setExtraHTTPHeaders(ImmutableMap.of("customHeaderName", "customHeaderValue"))); | |
//add event listener to verify that requests are sending with the custom header | |
chromeDevTools.addListener(Network.requestWillBeSent(), requestWillBeSent -> Assert | |
.assertEquals(requestWillBeSent.getRequest().getHeaders().get("customHeaderName"), | |
"customHeaderValue")); | |
chromeDriver.get("https://apache.org"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment