Can I catch HTTP request\response from the protractor, I want to create E2E tests with validation of the web services using JSON.
Asked
Active
Viewed 282 times
0
-
can you provide more info on what you have tried and tested with? – giri-sh Sep 01 '15 at 13:00
-
3May be helpful: http://stackoverflow.com/questions/31682047/capture-server-json-response-in-end-to-end-test/31695997 – Michael Radionov Sep 01 '15 at 13:12
1 Answers
2
You can only capture request, response through a proxy. Selenium-webdriver doesn't support this feature since it is limited to only browser simulation. One of the most well known proxies for inspecting request, response is browsermob-proxy. You can either directly use its API or use the node client browsermob-node. Once You have a proxy running, you can set driver capabilities in your protractor config like below
capabilities: {
'proxy': {
'proxyType': 'manual',
'httpProxy': 'hostname.com:1234'
}
}

nilesh
- 14,131
- 7
- 65
- 79