Skip to content

Commit

Permalink
Allow the legacy headless.mode property to work for Chrome and Edge
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Jul 28, 2022
1 parent e602b3f commit 3a83316
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import java.util.Arrays;
import java.util.List;

import static net.thucydides.core.ThucydidesSystemProperty.ACCEPT_INSECURE_CERTIFICATES;
import static net.thucydides.core.ThucydidesSystemProperty.HEADLESS_MODE;

public class ConfigureChromiumOptions {

private final EnvironmentVariables environmentVariables;
Expand Down Expand Up @@ -53,5 +56,16 @@ private void applyCustomChromeOptionsTo(ChromiumOptions<?> chromeOptions) {
}
}
);

//
// Headless mode from command line or headless.mode property
//
chromeOptions.setHeadless(HEADLESS_MODE.booleanFrom(environmentVariables,false));
//
// Legacy accept.insecure.certificates switch
//
chromeOptions.setAcceptInsecureCerts(ACCEPT_INSECURE_CERTIFICATES.booleanFrom(environmentVariables,false));


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import java.util.logging.Level;
import java.util.stream.Collectors;

import static net.thucydides.core.ThucydidesSystemProperty.HEADLESS_MODE;

/**
* Build a ChromeOptions or EdgeOptions object from a set of Desired Capabilities defined in the serenity.conf file.
*/
Expand Down Expand Up @@ -107,6 +109,7 @@ public static ChromiumOptions<?> fromDesiredCapabilities(DesiredCapabilities cap
} else if (capabilities.getCapability(EdgeOptions.LOGGING_PREFS) != null) {
setChromiumLoggingPreferences(capabilities, chromiumOptions);
}

return chromiumOptions;
}

Expand Down

0 comments on commit 3a83316

Please sign in to comment.