!https://github.com/sitespeedio/browsertime/workflows/Run%20Docker/badge.svg?branch=main !https://github.com/sitespeedio/browsertime/workflows/Unit%20tests/badge.svg?branch=main !https://github.com/sitespeedio/browsertime/workflows/Windows%20Edge/badge.svg?branch=main !https://github.com/sitespeedio/browsertime/workflows/OSX%20Safari/badge.svg?branch=main !https://github.com/sitespeedio/browsertime/workflows/Linux%20browsers/badge.svg?branch=main https://github.com/tobli/sitespeedio/stargazers
Documentation | https://github.com/sitespeedio/browsertime/blob/main/CHANGELOG.md
!Browsertime
Access the Web Performance Timeline, from your browser, in your terminal!
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:
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:
--firefox.geckoProfiler for Firefox and --chrome.timeline for Chromium browsers.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.
Use our Docker image (with Chrome, Firefox, Edge, 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 [] 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/[]
Checkout the examples.
Browsertime supports Firefox, Chrome, and Edge (Chromium version) on desktop and Safari on Mac OS. On Android we support Chrome and Firefox (from 8.0) and Safari on iOS. You can also use the Safari simulator on Mac OS.
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 https://github.com/firebug/har-export-trigger and Chrome we use https://github.com/sitespeedio/chrome-har to parse the timeline log and generate the HAR file.
It's easiest to run https://hub.docker.com/r/sitespeedio/browsertime/ to be able to record a video and calculate SpeedIndex because then you get all dependencies needed for free to run https://github.com/WPO-Foundation/visualmetrics.
The default video will include a timer and showing when the metrics happens, but you can turn that off using --video.addTimer false.
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/
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.
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.
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 https://github.com/Genymobile/gnirehtet or https://github.com/WPO-Foundation/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:
If you use Docker you will automatically get support for video and SpeedIndex. You can get that without Docker but then need to https://github.com/sitespeedio/docker-visualmetrics-deps/blob/main/Dockerfile 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
Run $ bin/browsertime.js --help and you can see the configuration options.
Our Docker container now included https://github.com/catapult-project/catapult/blob/main/web_page_replay_go/README.md.
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:
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:12.0.0 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:12.0.0 -b firefox -n 11 --firefox.acceptInsecureCerts 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
The easiest way to send metrics is to install https://stedolan.github.io/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
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。



探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
不支持 push
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务