All Projects → sitespeedio → Browsertime

sitespeedio / Browsertime

Licence: apache-2.0
Your browser, your page, your scripts!

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Browsertime

Automator
Various Automator and AppleScript workflow and scripts for simplifying life
Stars: ✭ 68 (-85.65%)
Mutual labels:  chrome, firefox, safari
Ocaramba
C# Framework to automate tests using Selenium WebDriver
Stars: ✭ 234 (-50.63%)
Mutual labels:  chrome, firefox, safari
Freedom
The Freedom to Open URLs in Third-Party Browsers on iOS with Custom UIActivity Subclasses.
Stars: ✭ 85 (-82.07%)
Mutual labels:  chrome, firefox, safari
Known Css Properties
List of standard and browser specific CSS properties.
Stars: ✭ 89 (-81.22%)
Mutual labels:  chrome, firefox, safari
Octotree
Browser extension that enhances GitHub code review and exploration. You can download Octotree for your browser from our website.
Stars: ✭ 21,726 (+4483.54%)
Mutual labels:  chrome, firefox, safari
Ublock
uBlock: a fast, lightweight, and lean blocker for Chrome, Firefox, and Safari.
Stars: ✭ 8,075 (+1603.59%)
Mutual labels:  chrome, firefox, safari
Lazy
Kule Lazy4 / CSS Framework
Stars: ✭ 147 (-68.99%)
Mutual labels:  chrome, firefox, safari
Etaoin
Pure Clojure Webdriver protocol implementation
Stars: ✭ 599 (+26.37%)
Mutual labels:  chrome, firefox, safari
Browser
The browser extension vault (Chrome, Firefox, Opera, Edge, Safari, & more).
Stars: ✭ 3,305 (+597.26%)
Mutual labels:  chrome, firefox, safari
Tua Body Scroll Lock
🔐 Body scroll locking that just works with everything
Stars: ✭ 236 (-50.21%)
Mutual labels:  chrome, firefox, safari
Supercookie
💭 Inspiration
Stars: ✭ 3,630 (+665.82%)
Mutual labels:  chrome, firefox, safari
Link Preview Js
Parse and/or extract web links meta information: title, description, images, videos, etc. [via OpenGraph], runs on mobiles and node.
Stars: ✭ 240 (-49.37%)
Mutual labels:  chrome, firefox, safari
Extension Create
Create modern cross-browser extensions with no build configuration.
Stars: ✭ 167 (-64.77%)
Mutual labels:  chrome, firefox, safari
Arduino Create Agent
The Arduino Create Agent
Stars: ✭ 298 (-37.13%)
Mutual labels:  chrome, firefox, safari
History Master
📈📉📊A Firefox/Chrome extension to visualize browsing history, sync among different browsers!
Stars: ✭ 356 (-24.89%)
Mutual labels:  chrome, firefox
Extanalysis
Browser Extension Analysis Framework - Scan, Analyze Chrome, firefox and Brave extensions for vulnerabilities and intels
Stars: ✭ 351 (-25.95%)
Mutual labels:  chrome, firefox
Webextension Toolbox
Small CLI toolbox for cross-browser WebExtension development
Stars: ✭ 365 (-23%)
Mutual labels:  chrome, firefox
Scriptsafe
a browser extension to bring security and privacy to chrome, firefox, and opera
Stars: ✭ 434 (-8.44%)
Mutual labels:  chrome, firefox
Headereditor
Manage browser's requests, include modify the request headers and response headers, redirect requests, cancel requests
Stars: ✭ 338 (-28.69%)
Mutual labels:  chrome, firefox
Epub Press Clients
📦 Clients for building books with EpubPress.
Stars: ✭ 370 (-21.94%)
Mutual labels:  chrome, firefox

Browsertime - Your browser, your page, your scripts!

Run Docker Unit tests Windows Edge OSX Safari Linux browsers Downloads Downloads total Stars

Documentation | Changelog

Browsertime

Access the Web Performance Timeline, from your browser, in your terminal!

Introduction

Browsertime lets you automate running JavaScript in your browser primary used to collect performance metrics. What exactly does that mean?

We think of a Browsertime as having four key capabilities:

What is Browsertime good for?

It is usually used for two different things:

  • You run it as a standalone tool to collect performance timing metrics of your web site.
  • You integrate it in your tool as a JavaScript runner that collects whatever JavaScript metrics/information you want.

To understand how Browsertime do these things, let's talk about how it works. Here's an example of what happens when you give Browsertime a URL to test:

  1. You give your configuration to Browsertime.
  2. Browsertime uses the WebDriver (through Selenium) to start Firefox/Chrome/Safari/Edge.
  3. Browsertime starts FFMPEG to record a video of the browser screen
  4. The browser access the URL.
  5. When the page is finished loading (you can define yourself when that happens), Browsertime executes the default JavaScript timing metrics and collects:
  6. It also collects a HAR file that shows all requests/responses on the page.
  7. FFMpeg is stopped and the video is analysed. Browsertime collect Visual Metrics like Speed Index.

The result of the run is a JSON file with all the JavaScript metrics collected, a HAR file, a video recording of the screen and a screenshot.

A simple example

Use our Docker image (with Chrome, Firefox, XVFB and the dependencies needed to record a video):

$ docker run --rm -v "$(pwd)":/browsertime sitespeedio/browsertime https://www.sitespeed.io/

Or using node:

$ npm install browsertime -g
$ browsertime https://www.sitespeed.io/

Load https://www.sitespeed.io/ in Chrome three times. Results are stored in a JSON file (browsertime.json) with the timing data, and a HAR file (browsertime.har) in browsertime-results/www.sitespeed.io/$date/

I want more examples

Checkout the examples.

Browsers

Browsertime supports Firefox, Chrome, and Edge (Chromium version) on desktop. There are also iimited support for Safari on desktop. On Android we support Chrome and Firefox (from 8.0) and Safari on iOS.

How does it work

Browsertime uses Selenium NodeJS to drive the browser. It starts the browser, load a URL, executes configurable Javascripts to collect metrics, collect a HAR file.

To get the HAR from Firefox we use the HAR Export Trigger and Chrome we use Chrome-HAR to parse the timeline log and generate the HAR file.

Speed Index and video

It's easiest to run our ready made Docker container to be able to record a video and calculate SpeedIndex because then you get all dependencies needed for free to run VisualMetrics.

The default video will include a timer and showing when the metrics happens, but you can turn that off using --video.addTimer false.

Test using Docker

You can build and test changes using Docker locally.

$ docker build -t sitespeedio/browsertime .
$ docker run --rm -v "$(pwd)":/browsertime sitespeedio/browsertime -n 1 https://www.sitespeed.io/

Connectivity

You can throttle the connection to make the connectivity slower to make it easier to catch regressions. The best way to do that is to setup a network bridge in Docker or use our connectivity engine Throttle. Read more about how to do that in the documentation.

Navigate in a script

If you need a more complicated test scenario, you can define your own (Selenium)test script that will do the testing. Use your own test script when you want to test your page as a logged in user, the login page or if you want to add things to your cart.

We have a full section in the documentation about scripting.

Test on your mobile device

Browsertime supports Chrome and Firefox on Android: Collecting SpeedIndex, HAR and video!

You need to install adb and prepare your phone before you start.

If you want to set connectivity you need to use something like gnirehtet or TSProxy. Read more information here.

$ browsertime --chrome.android.package com.android.chrome https://www.sitespeed.io --video --visualMetrics

If you are on Linux (we have tested Ubuntu 18) you can use our Docker container to drive your Android phone. A couple of things to remember:

  • You need to run in privileged mode --privileged if you share the full usb bus
  • You need to share the USB ports -v /dev/bus/usb:/dev/bus/usb or share a specific port with --device=/dev/bus/usb/001/017 (use lsusb to find the right mapping)
  • Add -e START_ADB_SERVER=true to start the adb server

If you use Docker you will automatically get support for video and SpeedIndex. You can get that without Docker but then need to install VisualMetrics dependencies yourself.

$ docker run --privileged -v /dev/bus/usb:/dev/bus/usb -e START_ADB_SERVER=true --rm -v "$(pwd)":/browsertime-results sitespeedio/browsertime -n 1 --android --visualMetrics --video https://en.m.wikipedia.org/wiki/Barack_Obama

Configuration

Run $ bin/browsertime.js --help and you can see the configuration options.

Using WebPageReplay

Our Docker container now included WebPageReplay.

WebPageReplay will let you replay your page locally (getting rid of server latency etc) and makes it easier to find front end regressions.

It works like this:

  1. The start script starts WebPageReplay in record mode
  2. Then starts Browsertime accessing the URL you choose one time (so it is recorded)
  3. WebPageReplay is closed down
  4. WebPageReplay in replay mode is started
  5. Browsertime access the URL so many times you choose
  6. WebPageReplay in replay mode is closed down

You can change latency by setting a Docker environment variable. Use REPLAY to turn on the reply functionality.

Default browser is Chrome:

docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/browsertime -e REPLAY=true -e LATENCY=100 sitespeedio/browsertime:9.2.1 https://en.wikipedia.org/wiki/Barack_Obama

Use Firefox:

docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/browsertime -e REPLAY=true -e LATENCY=100 sitespeedio/browsertime:9.2.1 -b firefox -n 11 https://en.wikipedia.org/wiki/Barack_Obama

And Chrome on your Android phone. This will only work on Linux because you need to be able to mount the usb port in Docker:

docker run --privileged -v /dev/bus/usb:/dev/bus/usb -e START_ADB_SERVER=true --cap-add=NET_ADMIN --rm -v “$(pwd)“:/browsertime -e REPLAY=true -e LATENCY=100 sitespeedio/browsertime https://en.m.wikipedia.org/wiki/Barack_Obama --android --chrome.args ignore-certificate-errors-spki-list=PhrPvGIaAMmd29hj8BCZOq096yj7uMpRNHpn5PDxI6I= -n 11 --chrome.args user-data-dir=/data/tmp/chrome

Send metrics to Graphite

The easiest way to send metrics is to install jq and use it to pick the values you wanna track.

Here's an example on how you can pickup the median SpeedIndex from Browsertime and send it to your Graphite instance.

echo "browsertime.your.key.SpeedIndex.median" $(cat /tmp/browsertime/browsertime.json | jq .[0].statistics.visualMetrics.SpeedIndex.median) "`date +%s`" | nc -q0 my.graphite.com 2003
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].