Advanced WebDriver Testing: Intercepting and Mocking Network
We've added various new/custom WebDriver commands to our Chrome Browsers.
- Throttle the network speed
- Fetch Network requests during your WebDriver tests
- Intercept and mock network responses during your tests
Throttle Network Speed
With this new option, you can simulate different network speeds during your test.
Simulate a 4G connection, specify a GPRS speed or even test how your page reacts when there's no internet connection (offline mode).
You can change these settings during your test, so it makes it very easily to test real life situations. For example; people using their cell-phone suddenly experience a slower connection.
Fetch Network Requests
You can now fetch all network requests and responses during your test.
As WebDriver does not support reading status codes, it is now possible to use this command to fetch the status code, response headers and request headers.
Intercept and Mock
With this functionality, you can intercept and change responses during your test:
- When a test visits a page, you can configure the browser to redirect to another page.
- Configure specific URLs to immediately return an error during your test. Useful to disable ads/trackers during your tests
- Change the entire response (body + headers) of any URL during your test.
Documentation for this new feature is available on our Debugging support page.
< Back to Blog Overview