forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support GeckoDriver addon install/uninstall commands
Adds support for the following commands introduced in GeckoDriver 0.17: * POST /session/{session id}/moz/addon/install * POST /session/{session id}/moz/addon/uninstall For Ruby, implemented as a role-based interface (though I'm not sure it was really needed in this case since it's unlikely that any other driver will ever support these commands). For Python, implemented directly in Firefox webdriver. Tests are missing because all the extension files available for Selenium build (legacy Firefox driver extension, Firebug in third_party) fail to install on latest versions of Firefox. Related to SeleniumHQ#4215.
- Loading branch information
Showing
7 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
rb/lib/selenium/webdriver/common/driver_extensions/has_addons.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# encoding: utf-8 | ||
# | ||
# 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 HasAddons | ||
|
||
# | ||
# Installs addon. | ||
# | ||
# @param [String] path Full path to addon file | ||
# @param [Boolean] temporary | ||
# @return [String] identifier of installed addon | ||
# | ||
|
||
def install_addon(path, temporary = nil) | ||
@bridge.install_addon(path, temporary) | ||
end | ||
|
||
# | ||
# Uninstalls addon. | ||
# | ||
# @param [String] id Identifier of installed addon | ||
# | ||
|
||
def uninstall_addon(id) | ||
@bridge.uninstall_addon(id) | ||
end | ||
|
||
end # HasAddons | ||
end # DriverExtensions | ||
end # WebDriver | ||
end # Selenium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# encoding: utf-8 | ||
# | ||
# 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 Firefox | ||
module Marionette | ||
module Bridge | ||
|
||
COMMANDS = { | ||
install_addon: [:post, 'session/:session_id/moz/addon/install'.freeze], | ||
uninstall_addon: [:post, 'session/:session_id/moz/addon/uninstall'.freeze] | ||
}.freeze | ||
|
||
def commands(command) | ||
COMMANDS[command] || super | ||
end | ||
|
||
def install_addon(path, temporary) | ||
payload = {path: path} | ||
payload.merge!(temporary: temporary) unless temporary.nil? | ||
execute :install_addon, {}, payload | ||
end | ||
|
||
def uninstall_addon(id) | ||
execute :uninstall_addon, {}, {id: id} | ||
end | ||
|
||
end # Bridge | ||
end # Marionette | ||
end # Firefox | ||
end # WebDriver | ||
end # Selenium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters