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 23
def network_connection_type
  connection_value = @bridge.getNetworkConnection

  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 33
def network_connection_type=(connection_type)
  raise ArgumentError, "Invalid connection type" unless valid_type? connection_type

  connection_value = type_to_values[connection_type]

  @bridge.setNetworkConnection 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 43
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 51
def valid_type?(type)
  type_to_values.keys.include? type
end
values_to_type() click to toggle source
# File lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb, line 47
def values_to_type
  type_to_values.invert
end