Only do this the first time.
$ git clone https://github.com/chromium/web-page-replay.git
$ cd web-page-replay
For network simulation, you can use https://github.com/WPO-Foundation/tsproxy which works on most platforms. More realistic network simulation options can be achieved through using tools like dummynet, but those only support limited platforms.
First you must record the web page or pages that you wish to replay.
$ sudo ./replay.py --record ~/archive.wpr
After you have created an archive, you may later replay it at any time.
$ sudo ./replay.py ~/archive.wpr
During replay, you may simulate desired network conditions. This is useful for benchmarking.
$ sudo ./replay.py --up 128KByte/s --down 4Mbit/s --delay_ms=100 archive.wpr
$ sudo ./replay.py --packet_loss_rate=0.01 ~/archive.wpr
You may choose to disable the forwarding of DNS requests to the local replay server. If DNS request forwarding is disabled, an external mechanism must be used to forward traffic to the replay server.
$ ./replay.py --no-dns_forwarding --record ~/archive.wpr
Alternatively, traffic forwarding may also be configured via command line flags.
$ google-chrome --host-resolver-rules="MAP * 127.0.0.1:80,EXCLUDE localhost"
By default, Web Page Replay, creates a self-signed certificate to serve SSL traffic. In order for it to work, browsers need to be configured to ignore certificate errors. Be aware that doing so opens a giant security hole.
$ google-chrome --ignore-certificate-errors
Firefox has a configuration file for exceptions. That requires listing each host that gets used. If you have a better solution, please add it to the comments below. IE and Safari options are also needed.
To turn off SSL support, run replay.py with “--no-ssl”.
On Linux, either of the following two errors are permission problems:
python: can't open file './replay.py': [Errno 13] Permission denied
Traceback (most recent call last): File "./replay.py", line 50, in <module> import dnsproxy File "/home/slamm/p/wpr/dnsproxy.py", line 19, in <module> import platformsettings ImportError: No module named platformsettings
This can happen if you checkout the files to an NFS directory. Either move the files to a local directory, or make them world readable/executable.
WPR can cause autofs to hang. On Ubuntu, the following command fixes it:
$ sudo restart autofs
For full usage instructions and advanced options, see the program's help.
$ ./replay.py --help