Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. manifest.json :
  2. {
  3. "manifest_version":2,
  4. "name":"Authentication for truelocal",
  5. "version":"1.0.0",
  6. "permissions": ["<all_urls>","webRequest","webRequestBlocking"],
  7. "background": {"scripts": ["background.js"]}
  8. }
  9.  
  10. background.js :
  11. chrome.webRequest.onAuthRequired.addListener(
  12. function handler(details) {
  13. var authCredentials= {username: "test", password: "test"};
  14. username= password=null;
  15. return {authCredentials: authCredentials};
  16. },
  17. {urls: ["<all_urls>"]},
  18. ['blocking']
  19. );
  20.  
  21. ChromeOptions options = new ChromeOptions();
  22. options.addArguments("--disable-extensions");
  23. options.addArguments("--incognito");
  24. options.addArguments("--allow-file-access-from-files ");
  25. options.addArguments("disable-infobars");
  26. options.addExtensions(new File(System.getProperty("user.dir")+"/exe/auth.zip"));
  27. options.addArguments("start-maximized");
  28. if(strMethod.equals("validateContentAsGoogleBot") || strMethod.equals("validateNavigationtoDeletedBDPAsBot")){
  29. options.addArguments("�user-agent=Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)");
  30. }
  31. caps.setCapability(ChromeOptions.CAPABILITY, options);
  32. caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
  33. System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir")+"/exe/chromedriver");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement