Skip to content

blacklist not blacklisting API calls #26

@PhilCoggins

Description

@PhilCoggins

I am trying to block all API requests to google from my selenium browser session using browsermob. Below is my code:

Capybara.register_driver :selenium_without_google do |app|
  filename = File.join(Rails.root, "lib", "browsermob", "bin", "browsermob-proxy")

  server = BrowserMob::Proxy::Server.new(filename) #=> #<BrowserMob::Proxy::Server:0x000001022c6ea8 ...>
  server.start

  proxy = server.create_proxy #=> #<BrowserMob::Proxy::Client:0x0000010224bdc0 ...>
  proxy.blacklist(/google/, '200')

  profile = Selenium::WebDriver::Firefox::Profile.new #=> #<Selenium::WebDriver::Firefox::Profile:0x000001022bf748 ...>
  profile.proxy = proxy.selenium_proxy
  Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
end

It is still sending out the API calls. Any direction you can give me on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions