123456789_123456789_123456789_123456789_123456789_

Class: Selenium::WebDriver::BiDi::Network

Relationships & Source Files
Inherits: Object
Defined in: rb/lib/selenium/webdriver/bidi/network.rb

Constant Summary

Class Method Summary

Instance Method Summary

Constructor Details

.new(bidi) ⇒ Network

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/network.rb', line 38

def initialize(bidi)
  @bidi = bidi
end

Instance Method Details

#add_intercept(phases: [], contexts: nil, url_patterns: nil)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/network.rb', line 42

def add_intercept(phases: [], contexts: nil, url_patterns: nil)
  @bidi.send_cmd('network.addIntercept', phases: phases, contexts: contexts, urlPatterns: url_patterns)
end

#continue_with_auth(request_id, username, password)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/network.rb', line 50

def continue_with_auth(request_id, username, password)
  @bidi.send_cmd(
    'network.continueWithAuth',
    'request' => request_id,
    'action' => 'provideCredentials',
    'credentials' => {
      'type' => 'password',
      'username' => username,
      'password' => password
    }
  )
end

#continue_with_request(**args)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/network.rb', line 63

def continue_with_request(**args)
  @bidi.send_cmd(
    'network.continueWithRequest',
    request: args[:request_id],
    'body' => args[:body],
    'cookies' => args[:cookies],
    'headers' => args[:headers],
    'method' => args[:method],
    'url' => args[:url]
  )
end

#on(event)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/network.rb', line 75

def on(event, &)
  event = EVENTS[event] if event.is_a?(Symbol)
  @bidi.add_callback(event, &)
end

#remove_intercept(intercept)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/network.rb', line 46

def remove_intercept(intercept)
  @bidi.send_cmd('network.removeIntercept', intercept: intercept)
end