top of page

public static WebDriver initChromeDriver()
    {
        
        try {
            System.setProperty("webdriver.chrome.driver",getData(xmlPath,"ChromePath",0));

            ChromeOptions options = new ChromeOptions();

            HashMap<String, Object> chromeOptionsMap = new HashMap<String, Object>();
            chromeOptionsMap.put("plugins.plugins_disabled", new String[] {"Chrome PDF Viewer"});
            chromeOptionsMap.put("plugins.always_open_pdf_externally", true);
            options.setExperimentalOption("prefs", chromeOptionsMap);
            options.addArguments("--no-sandbox");
            chromeOptionsMap.put("download.default_directory", PDfPath);

            DesiredCapabilities cap = DesiredCapabilities.chrome();
            cap.setCapability(ChromeOptions.CAPABILITY, chromeOptionsMap);
            cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
            cap.setCapability(ChromeOptions.CAPABILITY, options);
            driver = new ChromeDriver(cap);
        } 
        catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
        return driver;
    }

    

Selenium - izselenium aoutomation tool

054-8059589

  • White Facebook Icon
  • White Twitter Icon
  • White Google+ Icon
  • White YouTube Icon

© 2017 by izselenium

bottom of page