public class ChromeLauncher extends Object implements AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static interface |
ChromeLauncher.Environment
Environment interface.
|
static class |
ChromeLauncher.RuntimeShutdownHookRegistry
Runtime based shutdown hook.
|
static interface |
ChromeLauncher.ShutdownHookRegistry
Shutdown hooks registry.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ENV_CHROME_PATH
CHROME_PATH environment var
|
| Constructor and Description |
|---|
ChromeLauncher()
Instantiates a new Chrome launcher.
|
ChromeLauncher(ChromeLauncherConfiguration configuration)
Instantiates a new Chrome launcher.
|
ChromeLauncher(ProcessLauncher processLauncher,
ChromeLauncher.Environment environment,
ChromeLauncher.ShutdownHookRegistry shutdownHookRegistry,
ChromeLauncherConfiguration configuration)
Instantiates a new Chrome launcher with a process launcher.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
exitValue()
Returns an exit value.
|
Path |
getChromeBinaryPath()
Returns the chrome binary path.
|
boolean |
isAlive()
Tests whether the subprocess is alive.
|
ChromeService |
launch()
Launches a headless chrome with default arguments.
|
ChromeService |
launch(boolean headless)
Launches a chrome with default arguments.
|
ChromeService |
launch(ChromeArguments chromeArguments)
Launches a chrome given its path and arguments.
|
ChromeService |
launch(Path chromeBinaryPath,
ChromeArguments chromeArguments)
Launches a chrome given its path and arguments.
|
public static final String ENV_CHROME_PATH
public ChromeLauncher()
public ChromeLauncher(ChromeLauncherConfiguration configuration)
configuration - Launch configuration.public ChromeLauncher(ProcessLauncher processLauncher, ChromeLauncher.Environment environment, ChromeLauncher.ShutdownHookRegistry shutdownHookRegistry, ChromeLauncherConfiguration configuration)
processLauncher - Process launcher.environment - Environment interface.shutdownHookRegistry - Shutdown hooks registry.public ChromeService launch(Path chromeBinaryPath, ChromeArguments chromeArguments) throws ChromeProcessException
chromeBinaryPath - the chrome binary pathchromeArguments - the chrome argumentsIllegalStateException - If chrome process has already been started.ChromeProcessException - If an I/O error occurs during chrome process start.ChromeProcessTimeoutException - If timeout expired while waiting for chrome to start.public ChromeService launch(ChromeArguments chromeArguments) throws ChromeProcessException
chromeArguments - the chrome argumentsIllegalStateException - If chrome process has already been started.ChromeProcessException - If an I/O error occurs during chrome process start.ChromeProcessTimeoutException - If timeout expired while waiting for chrome to start.public ChromeService launch(boolean headless) throws ChromeProcessException
headless - Headless flag.IllegalStateException - If chrome process has already been started.ChromeProcessException - If an I/O error occurs during chrome process start.ChromeProcessTimeoutException - If timeout expired while waiting for chrome to start.public ChromeService launch() throws ChromeProcessException
IllegalStateException - If chrome process has already been started.ChromeProcessException - If an I/O error occurs during chrome process start.ChromeProcessTimeoutException - If timeout expired while waiting for chrome to start.public Path getChromeBinaryPath()
public void close()
close in interface AutoCloseablepublic int exitValue()
Process.exitValue().{@link - IllegalThreadStateException} if the subprocess has not yet terminated. IllegalStateException If the process hasn't even started.public boolean isAlive()
Process.isAlive().IllegalThreadStateException - if the subprocess has not yet terminated.Copyright © 2020. All rights reserved.