Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Dec 31, 2018 11:18

For automation testing where you don't need a visible UI shell.


  1. Run Perfecto wizard from ide to create project.
  2. Add the following code to main

    public static void main(String[] args) throws IOException {
        System.out.println("Run started");
        String host = "[cloud]";
        ChromeOptions chromeOptions = new ChromeOptions();
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
        capabilities.setCapability("securityToken", "[replace with securityToken]");
        capabilities.setCapability("platformName", "Windows");
        capabilities.setCapability("platformVersion", "10");
        capabilities.setCapability("browserName", "Chrome");
        capabilities.setCapability("browserVersion", "latest");
        capabilities.setCapability("location", "US East");

    Optional: Capture Screenshots to show what pages were visited.

    // write your code here
    reportiumClient.stepStart("Goto CNN");
    File file = driver.getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(file,new File("ScreenShot-cnn.jpg"));
    reportiumClient.stepStart("Goto Google News");
    file = driver.getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(file,new File("ScreenShot-googlenews.jpg"));

     Check Execution report to see that Chrome was running in Headless Mode.

Google - Getting started with Headless Chrome

The power of Headless Chrome and browser automation (Google I/O '18)