ldaume / headless-chrome

Implementation of the new headless chrome with chromedriver and selenium.
MIT License
38 stars 15 forks source link

Headless chrome is not working secured intranet sites. #9

Open snpanigrahi9 opened 7 years ago

snpanigrahi9 commented 7 years ago

chrome version 62.0.3202.62 chrome driver 2.33 Platform Windows 7

Step to reproduce

package demo1;

import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.concurrent.TimeUnit;

import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.Keys; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait;

public class Headless {

public static void main(String[] args) throws InterruptedException, IOException
{ 

    System.setProperty("webdriver.chrome.driver", "C:\\MyWorkspace\\Demo\\chromedriver.exe");
    DesiredCapabilities caps = DesiredCapabilities.chrome();
    caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    caps.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.addArguments("--headless");
    chromeOptions.addArguments("--enable-logging");
    chromeOptions.addArguments("--v=99");
    //chromeOptions.addArguments("window-size=1280,1696");
    caps.setCapability(ChromeOptions.CAPABILITY, chromeOptions );
    WebDriver driver = new ChromeDriver(caps);

    driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
    //driver.get("https://pfo-18422.dev.upoint.hewitt.com/web/hmorg/client-tooling-login");
    driver.get("https://newcointranet.com/");
    //driver.get("http://ukvmgdev117.uk.aon.bz:9089/navigator/?desktop=UKN");
    driver.manage().window().setSize(new Dimension(1280,1696));
    Thread.sleep(10000);
    String st = driver.getTitle();
    System.out.println(st);

    File screenshotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(screenshotFile, new File("C:\\Users\\A0705286\\Desktop\\ScreenShot\\first.bmp"));

    }       
}
ldaume commented 6 years ago

Sorry for this late answer. It looks like it is a problem in the headless chrome. Issue is already available at https://bugs.chromium.org/p/chromium/issues/detail?id=721739 ;)