Module: Selenium::WebDriver::Chromium::Features

Included in:
Selenium::WebDriver::Chrome::Features, Edge::Features
Defined in:
rb/lib/selenium/webdriver/chromium/features.rb

Constant Summary collapse

CHROMIUM_COMMANDS =
{
  launch_app: [:post, 'session/:session_id/chromium/launch_app'],
  get_network_conditions: [:get, 'session/:session_id/chromium/network_conditions'],
  set_network_conditions: [:post, 'session/:session_id/chromium/network_conditions'],
  delete_network_conditions: [:delete, 'session/:session_id/chromium/network_conditions'],
  set_permission: [:post, 'session/:session_id/permissions'],
  get_available_log_types: [:get, 'session/:session_id/se/log/types'],
  get_log: [:post, 'session/:session_id/se/log']
}.freeze

Instance Method Summary collapse

Instance Method Details

#available_log_typesObject



82
83
84
85
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 82

def available_log_types
  types = execute :get_available_log_types
  Array(types).map(&:to_sym)
end

#cast_issue_messageObject



46
47
48
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 46

def cast_issue_message
  execute :cast_issue_message
end

#cast_sink_to_use=(name) ⇒ Object



42
43
44
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 42

def cast_sink_to_use=(name)
  execute :set_cast_sink_to_use, {}, {sinkName: name}
end

#cast_sinksObject



38
39
40
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 38

def cast_sinks
  execute :get_cast_sinks
end

#delete_network_conditionsObject



74
75
76
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 74

def delete_network_conditions
  execute :delete_network_conditions
end

#launch_app(id) ⇒ Object



34
35
36
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 34

def launch_app(id)
  execute :launch_app, {}, {id: id}
end

#log(type) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 87

def log(type)
  data = execute :get_log, {}, {type: type.to_s}

  Array(data).map do |l|
    LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
  rescue KeyError
    next
  end
end

#network_conditionsObject



66
67
68
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 66

def network_conditions
  execute :get_network_conditions
end

#network_conditions=(conditions) ⇒ Object



70
71
72
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 70

def network_conditions=(conditions)
  execute :set_network_conditions, {}, {network_conditions: conditions}
end

#send_command(command_params) ⇒ Object



78
79
80
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 78

def send_command(command_params)
  execute :send_command, {}, command_params
end

#set_permission(name, value) ⇒ Object



62
63
64
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 62

def set_permission(name, value)
  execute :set_permission, {}, {descriptor: {name: name}, state: value}
end

#start_cast_desktop_mirroring(name) ⇒ Object



54
55
56
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 54

def start_cast_desktop_mirroring(name)
  execute :start_cast_desktop_mirroring, {}, {sinkName: name}
end

#start_cast_tab_mirroring(name) ⇒ Object



50
51
52
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 50

def start_cast_tab_mirroring(name)
  execute :start_cast_tab_mirroring, {}, {sinkName: name}
end

#stop_casting(name) ⇒ Object



58
59
60
# File 'rb/lib/selenium/webdriver/chromium/features.rb', line 58

def stop_casting(name)
  execute :stop_casting, {}, {sinkName: name}
end