Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Chrome Driver with ModHeaders extension in Java
String userHome = System.getProperty("user.home");
options.addExtensions(new File(userHome + "\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Extensions\\idgpnmonknjnojddfkpgkljpfnnfcklj\\2.1.2_0.crx"));
// Enable LocalStorage
driver.navigate().to("chrome-extension://idgpnmonknjnojddfkpgkljpfnnfcklj/icon.png");
((JavascriptExecutor)driver).executeScript(
"localStorage.setItem('profiles', JSON.stringify([{" +
" title: 'Selenium', hideComment: true, appendMode: ''," +
" headers: [" +
" {enabled: true, name: 'oam_remote_user', value: '00171403', comment: ''}, " +
" {enabled: true, name: 'spa-username', value: '00171403', comment: ''} " +
" ]," +
" respHeaders: []," +
" filters: []" +
"}]));");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment