Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- manifest.json :
- {
- "manifest_version":2,
- "name":"Authentication for truelocal",
- "version":"1.0.0",
- "permissions": ["<all_urls>","webRequest","webRequestBlocking"],
- "background": {"scripts": ["background.js"]}
- }
- background.js :
- chrome.webRequest.onAuthRequired.addListener(
- function handler(details) {
- var authCredentials= {username: "test", password: "test"};
- username= password=null;
- return {authCredentials: authCredentials};
- },
- {urls: ["<all_urls>"]},
- ['blocking']
- );
- ChromeOptions options = new ChromeOptions();
- options.addArguments("--disable-extensions");
- options.addArguments("--incognito");
- options.addArguments("--allow-file-access-from-files ");
- options.addArguments("disable-infobars");
- options.addExtensions(new File(System.getProperty("user.dir")+"/exe/auth.zip"));
- options.addArguments("start-maximized");
- if(strMethod.equals("validateContentAsGoogleBot") || strMethod.equals("validateNavigationtoDeletedBDPAsBot")){
- options.addArguments("�user-agent=Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)");
- }
- caps.setCapability(ChromeOptions.CAPABILITY, options);
- caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
- System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir")+"/exe/chromedriver");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement