module Selenium::WebDriver::DriverExtensions::HasNetworkConnection

Public Instance Methods

network_connection_type() click to toggle source
# File lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb, line 24
def network_connection_type
  connection_value = @bridge.network_connection

  connection_type = values_to_type[connection_value]

  # In case the connection type is not recognized return the
  # connection value.
  connection_type || connection_value
end
network_connection_type=(connection_type) click to toggle source
# File lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb, line 34
def network_connection_type=(connection_type)
  raise ArgumentError, 'Invalid connection type' unless valid_type? connection_type

  connection_value = type_to_values[connection_type]

  @bridge.network_connection = connection_value
end

Private Instance Methods

type_to_values() click to toggle source
# File lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb, line 44
def type_to_values
  {airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}
end
valid_type?(type) click to toggle source
# File lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb, line 52
def valid_type?(type)
  type_to_values.key? type
end
values_to_type() click to toggle source
# File lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb, line 48
def values_to_type
  type_to_values.invert
end