Overview
HasLaunchApp is a Java interface that provides the ability to launch a Chromium application (such as a Chrome App or Progressive Web App) by its identifier.
Description
The HasLaunchApp interface, annotated with @Beta, declares a single method launchApp(String id) that triggers the launch of a Chromium app identified by the given ID. This leverages the ChromeDriver-specific launchApp command, which is a vendor extension to the WebDriver protocol. The interface is implemented by Chromium-based driver classes such as ChromeDriver and EdgeDriver.
Usage
Use HasLaunchApp when your test automation needs to launch a Chrome App or PWA that is installed in the browser. Cast the driver to HasLaunchApp to invoke the launchApp method with the application's identifier.
Code Reference
Source Location
Signature
@Beta
public interface HasLaunchApp {
void launchApp(String id);
}
Import
import org.openqa.selenium.chromium.HasLaunchApp;
I/O Contract
Methods
| Method |
Parameters |
Return Type |
Description
|
launchApp(String) |
id -- the identifier of the Chromium app to launch |
void |
Launches the specified Chromium application. The ID corresponds to the app's unique identifier as recognized by the Chrome browser (e.g., a Chrome extension or app ID).
|
Input
| Parameter |
Type |
Description
|
id |
String |
The unique identifier of the Chromium app to launch. This is typically a 32-character alphanumeric string for Chrome extensions/apps.
|
Output
| Return Type |
Description
|
void |
No return value. The method triggers the app launch as a side effect.
|
Usage Examples
ChromeDriver driver = new ChromeDriver();
// Cast the driver to HasLaunchApp
HasLaunchApp launchAppDriver = (HasLaunchApp) driver;
// Launch a Chrome App by its ID
// (e.g., the Google Docs Chrome App)
launchAppDriver.launchApp("aohghmighlieiainnegkcijnfilokake");
// Launch a Progressive Web App by its app ID
launchAppDriver.launchApp("my-pwa-app-id");
driver.quit();
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.