diff --git a/src/main/java/io/appium/java_client/chromium/ChromiumDriver.java b/src/main/java/io/appium/java_client/chromium/ChromiumDriver.java
new file mode 100644
index 000000000..e6366f708
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/ChromiumDriver.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium;
+
+import io.appium.java_client.AppiumClientConfig;
+import io.appium.java_client.AppiumDriver;
+import io.appium.java_client.remote.AutomationName;
+import io.appium.java_client.service.local.AppiumDriverLocalService;
+import io.appium.java_client.service.local.AppiumServiceBuilder;
+import org.openqa.selenium.Capabilities;
+import org.openqa.selenium.remote.HttpCommandExecutor;
+import org.openqa.selenium.remote.http.ClientConfig;
+import org.openqa.selenium.remote.http.HttpClient;
+
+import java.net.URL;
+
+/**
+ *
ChromiumDriver is an officially supported Appium driver created to automate Mobile browsers
+ * and web views based on the Chromium engine. The driver uses W3CWebDriver protocol and is built
+ * on top of chromium driver server.
+ *
+ * Read appium-chromium-driver
+ * for more details on how to configure and use it.
+ */
+public class ChromiumDriver extends AppiumDriver {
+ private static final String AUTOMATION_NAME = AutomationName.CHROMIUM;
+
+ public ChromiumDriver(HttpCommandExecutor executor, Capabilities capabilities) {
+ super(executor, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ public ChromiumDriver(URL remoteAddress, Capabilities capabilities) {
+ super(remoteAddress, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ public ChromiumDriver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities capabilities) {
+ super(remoteAddress, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ public ChromiumDriver(AppiumDriverLocalService service, Capabilities capabilities) {
+ super(service, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ public ChromiumDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory,
+ Capabilities capabilities) {
+ super(service, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ public ChromiumDriver(AppiumServiceBuilder builder, Capabilities capabilities) {
+ super(builder, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ public ChromiumDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory,
+ Capabilities capabilities) {
+ super(builder, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ public ChromiumDriver(HttpClient.Factory httpClientFactory, Capabilities capabilities) {
+ super(httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ /**
+ * This is a special constructor used to connect to a running driver instance.
+ * It does not do any necessary verifications, but rather assumes the given
+ * driver session is already running at `remoteSessionAddress`.
+ * The maintenance of driver state(s) is the caller's responsibility.
+ * !!! This API is supposed to be used for **debugging purposes only**.
+ *
+ * @param remoteSessionAddress The address of the **running** session including the session identifier.
+ * @param platformName The name of the target platform.
+ */
+ public ChromiumDriver(URL remoteSessionAddress, String platformName) {
+ super(remoteSessionAddress, platformName, AUTOMATION_NAME);
+ }
+
+ /**
+ * Creates a new instance based on the given ClientConfig and {@code capabilities}.
+ * The HTTP client is default client generated by {@link HttpCommandExecutor#getDefaultClientFactory}.
+ * For example:
+ *
+ *
+ *
+ * ClientConfig clientConfig = ClientConfig.defaultConfig()
+ * .baseUri(URI.create("WebDriver URL"))
+ * .readTimeout(Duration.ofMinutes(5));
+ * ChromiumOptions options = new ChromiumOptions();
+ * ChromiumDriver driver = new ChromiumDriver(clientConfig, options);
+ *
+ *
+ *
+ * @param clientConfig take a look at {@link ClientConfig}
+ * @param capabilities take a look at {@link Capabilities}
+ *
+ */
+ public ChromiumDriver(ClientConfig clientConfig, Capabilities capabilities) {
+ super(AppiumClientConfig.fromClientConfig(clientConfig), ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ /**
+ * Creates a new instance based on the given ClientConfig and {@code capabilities}.
+ * The HTTP client is default client generated by {@link HttpCommandExecutor#getDefaultClientFactory}.
+ * For example:
+ *
+ *
+ *
+ * AppiumClientConfig appiumClientConfig = AppiumClientConfig.defaultConfig()
+ * .directConnect(true)
+ * .baseUri(URI.create("WebDriver URL"))
+ * .readTimeout(Duration.ofMinutes(5));
+ * ChromiumOptions options = new ChromiumOptions();
+ * ChromiumDriver driver = new ChromiumDriver(options, appiumClientConfig);
+ *
+ *
+ *
+ * @param appiumClientConfig take a look at {@link AppiumClientConfig}
+ * @param capabilities take a look at {@link Capabilities}
+ *
+ */
+ public ChromiumDriver(AppiumClientConfig appiumClientConfig, Capabilities capabilities) {
+ super(appiumClientConfig, ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+
+ public ChromiumDriver(Capabilities capabilities) {
+ super(ensureAutomationName(capabilities, AUTOMATION_NAME));
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/ChromiumOptions.java b/src/main/java/io/appium/java_client/chromium/options/ChromiumOptions.java
new file mode 100644
index 000000000..dfc5d7d02
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/ChromiumOptions.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.AutomationName;
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.SupportsBrowserNameOption;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Map;
+
+/**
+ * Options class that sets options for Chromium when testing websites.
+ *
+ * @see appium-chromium-driver usage section
+ */
+public class ChromiumOptions extends BaseOptions implements
+ SupportsBrowserNameOption,
+ SupportsChromeDrivePortOption,
+ SupportsExecutableOption,
+ SupportsExecutableDirOption,
+ SupportsVerboseOption,
+ SupportsLogPathOption,
+ SupportsBuildCheckOption,
+ SupportsAutodownloadOption,
+ SupportsUseSystemExecutableOption {
+ public ChromiumOptions() {
+ setCommonOptions();
+ }
+
+ public ChromiumOptions(Capabilities source) {
+ super(source);
+ setCommonOptions();
+ }
+
+ public ChromiumOptions(Map source) {
+ super(source);
+ setCommonOptions();
+ }
+
+ private void setCommonOptions() {
+ setAutomationName(AutomationName.CHROMIUM);
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsAutodownloadOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsAutodownloadOption.java
new file mode 100644
index 000000000..a1cefdffe
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/SupportsAutodownloadOption.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.CanSetCapability;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Optional;
+
+import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean;
+
+public interface SupportsAutodownloadOption> extends
+ Capabilities, CanSetCapability {
+ String AUTODOWNLOAD_ENABLED = "autodownloadEnabled";
+
+ /**
+ * Set to false for disabling automatic downloading of Chrome drivers.
+ * Unless disable build check preference has been user-set, the capability
+ * is present because the default value is true.
+ *
+ * @param autodownloadEnabled flag.
+ * @return self instance for chaining.
+ */
+ default T setAutodownloadEnabled(boolean autodownloadEnabled) {
+ return amend(AUTODOWNLOAD_ENABLED, autodownloadEnabled);
+ }
+
+ /**
+ * Get the auto download flag.
+ *
+ * @return auto download flag.
+ */
+ default Optional isAutodownloadEnabled() {
+ return Optional.ofNullable(toSafeBoolean(getCapability(AUTODOWNLOAD_ENABLED)));
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsBuildCheckOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsBuildCheckOption.java
new file mode 100644
index 000000000..d9e95f065
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/SupportsBuildCheckOption.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.CanSetCapability;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Optional;
+
+import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean;
+
+public interface SupportsBuildCheckOption> extends
+ Capabilities, CanSetCapability {
+ String DISABLE_BUILD_CHECK = "disableBuildCheck";
+
+ /**
+ * Set to true to add the --disable-build-check flag when starting WebDriver.
+ * Unless disable build check preference has been user-set, the capability
+ * is not present because the default value is false.
+ *
+ * @param BuildCheckDisabled flag for --disable-build-check.
+ * @return self instance for chaining.
+ */
+ default T setBuildCheckDisabled(boolean BuildCheckDisabled) {
+ return amend(DISABLE_BUILD_CHECK, BuildCheckDisabled);
+ }
+
+ /**
+ * Get disable build check flag.
+ *
+ * @return disable build check flag.
+ */
+ default Optional isBuildCheckDisabled() {
+ return Optional.ofNullable(toSafeBoolean(getCapability(DISABLE_BUILD_CHECK)));
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsChromeDrivePortOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsChromeDrivePortOption.java
new file mode 100644
index 000000000..68cace279
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/SupportsChromeDrivePortOption.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.CanSetCapability;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Optional;
+
+import static io.appium.java_client.internal.CapabilityHelpers.toInteger;
+
+public interface SupportsChromeDrivePortOption> extends
+ Capabilities, CanSetCapability {
+ String CHROME_DRIVER_PORT = "chromedriverPort";
+
+ /**
+ * The port to start WebDriver processes on. Unless the chrome drive port preference
+ * has been user-set, it will listen on port 9515, which is the default
+ * value for this capability.
+ *
+ * @param port port number in range 0..65535.
+ * @return self instance for chaining.
+ */
+ default T setChromeDriverPort(int port) {
+ return amend(CHROME_DRIVER_PORT, port);
+ }
+
+ /**
+ * Get the number of the port for the chrome driver to listen on.
+ *
+ * @return Chrome driver port value.
+ */
+ default Optional getChromeDriverPort() {
+ return Optional.ofNullable(toInteger(getCapability(CHROME_DRIVER_PORT)));
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableDirOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableDirOption.java
new file mode 100644
index 000000000..c525ab7ad
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableDirOption.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.CanSetCapability;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Optional;
+
+public interface SupportsExecutableDirOption> extends
+ Capabilities, CanSetCapability {
+ String EXECUTABLE_DIR = "executableDir";
+
+ /**
+ * A directory within which is found any number of WebDriver binaries.
+ * If set, the driver will search this directory for WebDrivers of the
+ * appropriate version to use for your browser.
+ *
+ * @param directory of WebDriver binaries.
+ * @return self instance for chaining.
+ */
+ default T setExecutableDir(String directory) {
+ return amend(EXECUTABLE_DIR, directory);
+ }
+
+ /**
+ * Get a directory within which is found any number of WebDriver binaries.
+ *
+ * @return executable directory of a Driver binary.
+ */
+ default Optional getExecutableDir() {
+ return Optional.ofNullable((String) getCapability(EXECUTABLE_DIR));
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableOption.java
new file mode 100644
index 000000000..84e730e62
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableOption.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.CanSetCapability;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Optional;
+
+public interface SupportsExecutableOption> extends
+ Capabilities, CanSetCapability {
+ String EXECUTABLE = "executable";
+
+ /**
+ * The absolute path to a WebDriver binary executable.
+ * If set, the driver will use that path instead of its own WebDriver.
+ *
+ * @param path absolute of a WebDriver.
+ * @return self instance for chaining.
+ */
+ default T setExecutable(String path) {
+ return amend(EXECUTABLE, path);
+ }
+
+ /**
+ * Get the absolute path to a WebDriver binary executable.
+ *
+ * @return executable absolute path.
+ */
+ default Optional getExecutable() {
+ return Optional.ofNullable((String) getCapability(EXECUTABLE));
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsLogPathOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsLogPathOption.java
new file mode 100644
index 000000000..cf1b8713d
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/SupportsLogPathOption.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.CanSetCapability;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Optional;
+
+public interface SupportsLogPathOption> extends
+ Capabilities, CanSetCapability {
+ String LOG_PATH = "logPath";
+
+ /**
+ * If set, the path to use with the --log-path parameter directing
+ * WebDriver to write its log to that path.
+ *
+ * @param logPath where to write the logs.
+ * @return self instance for chaining.
+ */
+ default T setLogPath(String logPath) {
+ return amend(LOG_PATH, logPath);
+ }
+
+ /**
+ * Get the log path where the WebDrive writes the logs.
+ *
+ * @return the log path.
+ */
+ default Optional getLogPath() {
+ return Optional.ofNullable((String) getCapability(LOG_PATH));
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsUseSystemExecutableOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsUseSystemExecutableOption.java
new file mode 100644
index 000000000..6d51b332b
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/SupportsUseSystemExecutableOption.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.CanSetCapability;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Optional;
+
+import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean;
+
+public interface SupportsUseSystemExecutableOption> extends
+ Capabilities, CanSetCapability {
+ String USE_SYSTEM_EXECUTABLE = "useSystemExecutable";
+
+ /**
+ * Set to true to use the version of WebDriver bundled with this driver,
+ * rather than attempting to download a new one based on the version of the
+ * browser under test.
+ * Unless disable build check preference has been user-set, the capability
+ * is not present because the default value is false.
+ *
+ * @param useSystemExecutable flag.
+ * @return self instance for chaining.
+ */
+ default T setUseSystemExecutable(boolean useSystemExecutable) {
+ return amend(USE_SYSTEM_EXECUTABLE, useSystemExecutable);
+ }
+
+ /**
+ * Get the use system executable flag.
+ *
+ * @return use system executable flag.
+ */
+ default Optional isUseSystemExecutable() {
+ return Optional.ofNullable(toSafeBoolean(getCapability(USE_SYSTEM_EXECUTABLE)));
+ }
+}
diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsVerboseOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsVerboseOption.java
new file mode 100644
index 000000000..14aa571d2
--- /dev/null
+++ b/src/main/java/io/appium/java_client/chromium/options/SupportsVerboseOption.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.appium.java_client.chromium.options;
+
+import io.appium.java_client.remote.options.BaseOptions;
+import io.appium.java_client.remote.options.CanSetCapability;
+import org.openqa.selenium.Capabilities;
+
+import java.util.Optional;
+
+import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean;
+
+public interface SupportsVerboseOption> extends
+ Capabilities, CanSetCapability {
+ String VERBOSE = "verbose";
+
+ /**
+ * Set to true to add the --verbose flag when starting WebDriver.
+ * Unless the verbose preference has been user-set, the capability
+ * is not present because the default value is false.
+ *
+ * @param verbose flag for --verbose.
+ * @return self instance for chaining.
+ */
+ default T setVerbose(boolean verbose) {
+ return amend(VERBOSE, verbose);
+ }
+
+ /**
+ * Get the verbose flag.
+ *
+ * @return verbose flag.
+ */
+ default Optional isVerbose() {
+ return Optional.ofNullable(toSafeBoolean(getCapability(VERBOSE)));
+ }
+}
diff --git a/src/test/java/io/appium/java_client/drivers/options/OptionsBuildingTest.java b/src/test/java/io/appium/java_client/drivers/options/OptionsBuildingTest.java
index 908ff709e..04574448c 100644
--- a/src/test/java/io/appium/java_client/drivers/options/OptionsBuildingTest.java
+++ b/src/test/java/io/appium/java_client/drivers/options/OptionsBuildingTest.java
@@ -23,6 +23,7 @@
import io.appium.java_client.android.options.localization.AppLocale;
import io.appium.java_client.android.options.server.EspressoBuildConfig;
import io.appium.java_client.android.options.signing.KeystoreConfig;
+import io.appium.java_client.chromium.options.ChromiumOptions;
import io.appium.java_client.gecko.options.GeckoOptions;
import io.appium.java_client.gecko.options.Verbosity;
import io.appium.java_client.ios.options.XCUITestOptions;
@@ -112,7 +113,7 @@ public void canBuildEspressoOptions() {
assertEquals(Duration.ofSeconds(10), options.getNewCommandTimeout().orElse(null));
assertEquals("CN", options.getAppLocale().orElse(null).getCountry().orElse(null));
assertEquals(2, options.getEspressoBuildConfig().orElse(null)
- .left().getAdditionalAppDependencies().orElse(null).size());
+ .left().getAdditionalAppDependencies().orElse(null).size());
assertTrue(options.doesForceEspressoRebuild().orElse(false));
}
@@ -154,7 +155,7 @@ public void canBuildGeckoOptions() {
options.setNewCommandTimeout(Duration.ofSeconds(10))
.setVerbosity(Verbosity.TRACE)
.setMozFirefoxOptions(ImmutableMap.of(
- "profile", "yolo"
+ "profile", "yolo"
));
assertEquals(Duration.ofSeconds(10), options.getNewCommandTimeout().orElse(null));
assertEquals(Verbosity.TRACE, options.getVerbosity().orElse(null));
@@ -180,4 +181,33 @@ public void canBuildSafariOptions() {
assertTrue(options.getWebkitWebrtc().orElse(null)
.doesDisableInsecureMediaCapture().orElse(false));
}
+
+ @Test
+ public void canBuildChromiumOptions() {
+ // Given
+ // When
+ ChromiumOptions options = new ChromiumOptions();
+
+ options.setNewCommandTimeout(Duration.ofSeconds(10))
+ .setPlatformName(Platform.MAC.name())
+ .withBrowserName("Chrome")
+ .setAutodownloadEnabled(true)
+ .setBuildCheckDisabled(true)
+ .setChromeDriverPort(5485)
+ .setExecutable("/absolute/executable/path")
+ .setLogPath("/wonderful/log/path")
+ .setVerbose(true);
+
+ // Then
+ assertEquals(AutomationName.CHROMIUM, options.getAutomationName().orElse(null));
+ assertEquals("Chrome", options.getBrowserName());
+ assertTrue(options.isAutodownloadEnabled().orElse(null));
+ assertTrue(options.isBuildCheckDisabled().orElse(null));
+ assertEquals(5485, options.getChromeDriverPort().orElse(null));
+ assertFalse(options.getExecutableDir().isPresent());
+ assertEquals("/absolute/executable/path", options.getExecutable().orElse(null));
+ assertEquals("/wonderful/log/path", options.getLogPath().orElse(null));
+ assertFalse(options.isUseSystemExecutable().isPresent());
+ assertTrue(options.isVerbose().orElse(null));
+ }
}