How to use Interface HasLaunchApp class of org.openqa.selenium.chromium package

Best Selenium code snippet using org.openqa.selenium.chromium.Interface HasLaunchApp

Run Selenium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

copy
1// Licensed to the Software Freedom Conservancy (SFC) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The SFC licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18package org.openqa.selenium.chromium;
19
20import com.google.auto.service.AutoService;
21import com.google.common.collect.ImmutableMap;
22import org.openqa.selenium.Capabilities;
23import org.openqa.selenium.internal.Require;
24import org.openqa.selenium.remote.AdditionalHttpCommands;
25import org.openqa.selenium.remote.AugmenterProvider;
26import org.openqa.selenium.remote.CommandInfo;
27import org.openqa.selenium.remote.ExecuteMethod;
28import org.openqa.selenium.remote.http.HttpMethod;
29
30import java.util.Map;
31import java.util.function.Predicate;
32
33import static org.openqa.selenium.chromium.ChromiumDriver.IS_CHROMIUM_BROWSER;
34
35@AutoService({AdditionalHttpCommands.class, AugmenterProvider.class})
36public class AddHasLaunchApp implements AugmenterProvider<HasLaunchApp>, AdditionalHttpCommands {
37
38  public static final String LAUNCH_APP = "launchApp";
39
40  private static final Map<String, CommandInfo> COMMANDS = ImmutableMap.of(
41    LAUNCH_APP, new CommandInfo("/session/:sessionId/chromium/launch_app", HttpMethod.POST));
42
43  @Override
44  public Map<String, CommandInfo> getAdditionalCommands() {
45    return COMMANDS;
46  }
47
48  @Override
49  public Predicate<Capabilities> isApplicable() {
50    return caps -> IS_CHROMIUM_BROWSER.test(caps.getBrowserName());
51  }
52
53  @Override
54  public Class<HasLaunchApp> getDescribedInterface() {
55    return HasLaunchApp.class;
56  }
57
58  @Override
59  public HasLaunchApp getImplementation(Capabilities capabilities, ExecuteMethod executeMethod) {
60    return new HasLaunchApp() {
61      @Override
62      public void launchApp(String id) {
63        Require.nonNull("id of Chromium App", id);
64
65        executeMethod.execute(LAUNCH_APP, ImmutableMap.of("id", id));
66      }
67    };
68  }
69}
70
Full Screen
copy
1// Licensed to the Software Freedom Conservancy (SFC) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The SFC licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18package org.openqa.selenium.chromium;
19
20import org.openqa.selenium.Beta;
21
22/**
23 * Used by classes to indicate that they can launch a Chromium app.
24 */
25@Beta
26public interface HasLaunchApp {
27
28  /**
29   *
30   * @param id which Chromium app to launch.
31   */
32  void launchApp(String id);
33}
34
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

...Most popular Stackoverflow questions on Interface-HasLaunchApp

    No relevant questions found for this class 😞

Most used methods in Interface-HasLaunchApp

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)