Class: Selenium::DevTools::V131::DeviceAccess

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v131/device_access.rb

Constant Summary collapse

EVENTS =
{
  device_request_prompted: 'deviceRequestPrompted',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ DeviceAccess

Returns a new instance of DeviceAccess.



29
30
31
# File 'lib/selenium/devtools/v131/device_access.rb', line 29

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#cancel_prompt(id:) ⇒ Object



52
53
54
55
# File 'lib/selenium/devtools/v131/device_access.rb', line 52

def cancel_prompt(id:)
  @devtools.send_cmd('DeviceAccess.cancelPrompt',
                     id: id)
end

#disableObject



42
43
44
# File 'lib/selenium/devtools/v131/device_access.rb', line 42

def disable
  @devtools.send_cmd('DeviceAccess.disable')
end

#enableObject



38
39
40
# File 'lib/selenium/devtools/v131/device_access.rb', line 38

def enable
  @devtools.send_cmd('DeviceAccess.enable')
end

#on(event, &block) ⇒ Object



33
34
35
36
# File 'lib/selenium/devtools/v131/device_access.rb', line 33

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["DeviceAccess.#{event}"] << block
end

#select_prompt(id:, device_id:) ⇒ Object



46
47
48
49
50
# File 'lib/selenium/devtools/v131/device_access.rb', line 46

def select_prompt(id:, device_id:)
  @devtools.send_cmd('DeviceAccess.selectPrompt',
                     id: id,
                     deviceId: device_id)
end