Module: Selenium::WebDriver::Firefox::Features
- Defined in:
- lib/selenium/webdriver/firefox/features.rb
Constant Summary collapse
- FIREFOX_COMMANDS =
{ get_context: [:get, 'session/:session_id/moz/context'], set_context: [:post, 'session/:session_id/moz/context'], install_addon: [:post, 'session/:session_id/moz/addon/install'], uninstall_addon: [:post, 'session/:session_id/moz/addon/uninstall'], full_page_screenshot: [:get, 'session/:session_id/moz/screenshot/full'] }.freeze
Instance Method Summary collapse
- #command_list ⇒ Object
- #commands(command) ⇒ Object
- #context ⇒ Object
- #context=(context) ⇒ Object
- #full_screenshot ⇒ Object
- #install_addon(path, temporary) ⇒ Object
- #uninstall_addon(id) ⇒ Object
Instance Method Details
#command_list ⇒ Object
32 33 34 |
# File 'lib/selenium/webdriver/firefox/features.rb', line 32 def command_list FIREFOX_COMMANDS.merge(self.class::COMMANDS) end |
#commands(command) ⇒ Object
36 37 38 |
# File 'lib/selenium/webdriver/firefox/features.rb', line 36 def commands(command) command_list[command] end |
#context ⇒ Object
64 65 66 |
# File 'lib/selenium/webdriver/firefox/features.rb', line 64 def context execute :get_context end |
#context=(context) ⇒ Object
60 61 62 |
# File 'lib/selenium/webdriver/firefox/features.rb', line 60 def context=(context) execute :set_context, {}, {context: context} end |
#full_screenshot ⇒ Object
56 57 58 |
# File 'lib/selenium/webdriver/firefox/features.rb', line 56 def full_screenshot execute :full_page_screenshot end |
#install_addon(path, temporary) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/selenium/webdriver/firefox/features.rb', line 40 def install_addon(path, temporary) addon = if File.directory?(path) Zipper.zip(path) else File.open(path, 'rb') { |crx_file| Base64.strict_encode64 crx_file.read } end payload = {addon: addon} payload[:temporary] = temporary unless temporary.nil? execute :install_addon, {}, payload end |
#uninstall_addon(id) ⇒ Object
52 53 54 |
# File 'lib/selenium/webdriver/firefox/features.rb', line 52 def uninstall_addon(id) execute :uninstall_addon, {}, {id: id} end |