From 2086f382c5cdaa7e45f7719e9d43320da703e9a8 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Fri, 24 Sep 2021 01:11:55 -0500 Subject: [PATCH] [rb] implement chromium launch app functionality --- rb/lib/selenium/webdriver/chrome/driver.rb | 1 + rb/lib/selenium/webdriver/chrome/features.rb | 5 +++ rb/lib/selenium/webdriver/common.rb | 1 + .../common/driver_extensions/has_launching.rb | 32 +++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 rb/lib/selenium/webdriver/common/driver_extensions/has_launching.rb diff --git a/rb/lib/selenium/webdriver/chrome/driver.rb b/rb/lib/selenium/webdriver/chrome/driver.rb index 6e1b8e2a25e37..341d639c843c5 100644 --- a/rb/lib/selenium/webdriver/chrome/driver.rb +++ b/rb/lib/selenium/webdriver/chrome/driver.rb @@ -32,6 +32,7 @@ class Driver < WebDriver::Driver DriverExtensions::HasNetworkConditions, DriverExtensions::HasNetworkInterception, DriverExtensions::HasWebStorage, + DriverExtensions::HasLaunching, DriverExtensions::HasLocation, DriverExtensions::DownloadsFiles, DriverExtensions::HasDevTools, diff --git a/rb/lib/selenium/webdriver/chrome/features.rb b/rb/lib/selenium/webdriver/chrome/features.rb index 23fda1f14d416..149d1c3ecd544 100644 --- a/rb/lib/selenium/webdriver/chrome/features.rb +++ b/rb/lib/selenium/webdriver/chrome/features.rb @@ -23,6 +23,7 @@ module Chrome module Features CHROME_COMMANDS = { + launch_app: [:post, 'session/:session_id/chromium/launch_app'], get_cast_sinks: [:get, 'session/:session_id/goog/cast/get_sinks'], set_cast_sink_to_use: [:post, 'session/:session_id/goog/cast/set_sink_to_use'], start_cast_tab_mirroring: [:post, 'session/:session_id/goog/cast/start_tab_mirroring'], @@ -39,6 +40,10 @@ def commands(command) CHROME_COMMANDS[command] || self.class::COMMANDS[command] end + def launch_app(id) + execute :launch_app, {}, {id: id} + end + def cast_sinks execute :get_cast_sinks end diff --git a/rb/lib/selenium/webdriver/common.rb b/rb/lib/selenium/webdriver/common.rb index 05bfb042826e7..5cd421e86d7e0 100644 --- a/rb/lib/selenium/webdriver/common.rb +++ b/rb/lib/selenium/webdriver/common.rb @@ -71,6 +71,7 @@ require 'selenium/webdriver/common/driver_extensions/has_pinned_scripts' require 'selenium/webdriver/common/driver_extensions/has_cdp' require 'selenium/webdriver/common/driver_extensions/has_casting' +require 'selenium/webdriver/common/driver_extensions/has_launching' require 'selenium/webdriver/common/keys' require 'selenium/webdriver/common/profile_helper' require 'selenium/webdriver/common/options' diff --git a/rb/lib/selenium/webdriver/common/driver_extensions/has_launching.rb b/rb/lib/selenium/webdriver/common/driver_extensions/has_launching.rb new file mode 100644 index 0000000000000..9de796e0b872f --- /dev/null +++ b/rb/lib/selenium/webdriver/common/driver_extensions/has_launching.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +module Selenium + module WebDriver + module DriverExtensions + module HasLaunching + + def launch_app(id) + @bridge.launch_app(id) + end + + end # HasLaunching + end # DriverExtensions + end # WebDriver +end # Selenium