• Stars
    star
    219
  • Rank 181,133 (Top 4 %)
  • Language
    Python
  • Created about 13 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A python wrapper for Browsermob Proxy

browsermob-proxy-py

Python client for the BrowserMob Proxy 2.0 REST API.

How to use with selenium-webdriver

Manually:

from browsermobproxy import Server
server = Server("path/to/browsermob-proxy")
server.start()
proxy = server.create_proxy()

from selenium import webdriver
profile  = webdriver.FirefoxProfile()
profile.set_proxy(proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)


proxy.new_har("google")
driver.get("http://www.google.co.uk")
proxy.har # returns a HAR JSON blob

server.stop()
driver.quit()

for Chrome use

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--proxy-server={0}".format(proxy.proxy))
browser = webdriver.Chrome(chrome_options = chrome_options)

Running Tests

Install pytest if you don't have it already.

$ pip install pytest

Start a browsermob instance.

$ java -jar browsermob.jar --port 9090

In a separate window:

$ py.test

If you are going to watch the test, the 'human' ones should display an english muffin instead of the american flag on the 'pick your version' page. Or at least it does from Canada.

To run the tests in a CI environment, disable the ones that require human judgement by adding "-m "not human" test" to the py.test command.

$ py.test -m "not human" test

See also

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright 2011 David Burns

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

AutomatedTester.BrowserMob

.NET Library for working with BrowserMob proxy
C#
23
star
2

AutomatedTester.PagePerf

This is a project to use Firefox driver to record what is on the page by capturing the HAR file
C#
17
star
3

W3-BrowserAutomation

Mirror of http://dvcs.w3.org/hg/webdriver/
Python
16
star
4

Garmr

Security Testing Tool
Python
16
star
5

unittest-zero

This is a basic assert framework wraps native asserts into a compact DSL
Python
12
star
6

speedy-gonzales-proxy

A Selenium Grid Plugin that pings a server on the node
Java
11
star
7

Selenium-Proxy

A Selenium Proxy that translates the Selenium JSON Wire Protocol to Marionette Wire Protocol
JavaScript
10
star
8

node-pomodoro

A simple cli based pomodoro system
JavaScript
10
star
9

Bugsy

A python library for interacting with Bugzilla
Python
10
star
10

powerball-platform

An Experiment in Social Networking and QA'ing
JavaScript
9
star
11

github-travis-addon

This is a Firefox addon based on the Chrome Extension https://github.com/wereHamster/github-travis-chrome-extension
CSS
7
star
12

AutomatedPagePerf

A Mechanism to Record HAR files with Selenium in Python
Python
6
star
13

W3-BrowserAutomation-Tests

Mirror Tests for the W3C Browser Automation Specification - Work will be done at http://dvcs.w3.org/hg/webdriver-test
Python
6
star
14

browser-manager

Rust
5
star
15

speedy-gonzales-servlette

Java
4
star
16

seleniumbeginnerssite

Site used in my books
HTML
4
star
17

covid19

Website for rendering UK Covid Data as one graph using data from https://coronavirus.data.gov.uk/
JavaScript
4
star
18

personal

personal website
3
star
19

futurama-data

WebService that allows certain data required to make engineers more productive at Mozilla
Python
3
star
20

automation-services-bot

IRC bot to help out in Automation Services Channel on irc.mozilla.org
JavaScript
3
star
21

taskng

TaskNG is a very simple CLI based Task management tool
JavaScript
3
star
22

bisectcloud

Bisect in the Cloud. A mechanism to try find regressions in Firefox by parallelising regression testing against revisions
Python
2
star
23

VimSettings

2
star
24

automatedtester.github.com

home of http://oss.theautomatedtester.co.uk
2
star
25

Presentations

Demos from Presentations
JavaScript
2
star
26

rust-koans

Learn Rust by making tests pass
Rust
2
star
27

dotfiles

My collection of dotfiles
Vim Script
1
star
28

rogoto-core

A Logo inspired Robot built with a Raspberry Pi, Brick PI and Lego Technics
Python
1
star
29

testdayserver

Collects data from Test day bot and will do cool things with it.
Python
1
star
30

automationservic.es

JavaScript
1
star
31

sumodaybot

A IRC bot for greeting users when they join a SUMO Day
JavaScript
1
star