-
Notifications
You must be signed in to change notification settings - Fork 15
Description
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"));
}
}