Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public static SeleniumUtil initFirefoxDriver(String installationPath) throws IOException {
  2.  
  3. FirefoxBinary binary = null;
  4. if (System.getProperty("os.name").startsWith("Windows")) {
  5. binary = new FirefoxBinary(new File(installationPath + "/firefox.exe"));
  6. } else {
  7. binary = new FirefoxBinary(new File(installationPath + "/firefox"));
  8. }
  9.  
  10. FirefoxProfile profile = new FirefoxProfile();
  11.  
  12. File dir = new File(installationPath + "-addons");
  13. File[] addonFiles = dir.listFiles(FileUtil.getExtensionFilter(".xpi"));
  14. for (File addonFile : addonFiles) {
  15. profile.addExtension(addonFile);
  16. }
  17. profile.setPreference("extensions.firebug.currentVersion", "1.9.2b1");
  18.  
  19. // wait times out after 5 seconds
  20. return new SeleniumUtil(new FirefoxDriver(binary, profile), 5);
  21.  
  22. // driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement