Method: Selenium::WebDriver::Network#add_authentication_handler

Defined in:
lib/selenium/webdriver/common/network.rb

#add_authentication_handler(username = nil, password = nil, *filter, pattern_type: nil, &block) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/selenium/webdriver/common/network.rb', line 47

def add_authentication_handler(username = nil, password = nil, *filter, pattern_type: nil, &block)
  selected_block =
    if username && password
      proc { |auth| auth.authenticate(username, password) }
    else
      block
    end

  add_handler(
    :auth_required,
    BiDi::Network::PHASES[:auth_required],
    BiDi::InterceptedAuth,
    filter,
    pattern_type: pattern_type,
    &selected_block
  )
end