Skip to content

Commit

Permalink
[rb] implement chromium launch app functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Sep 24, 2021
1 parent 8aa962d commit 2086f38
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions rb/lib/selenium/webdriver/chrome/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Driver < WebDriver::Driver
DriverExtensions::HasNetworkConditions,
DriverExtensions::HasNetworkInterception,
DriverExtensions::HasWebStorage,
DriverExtensions::HasLaunching,
DriverExtensions::HasLocation,
DriverExtensions::DownloadsFiles,
DriverExtensions::HasDevTools,
Expand Down
5 changes: 5 additions & 0 deletions rb/lib/selenium/webdriver/chrome/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions rb/lib/selenium/webdriver/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2086f38

Please sign in to comment.