0

Can I catch HTTP request\response from the protractor, I want to create E2E tests with validation of the web services using JSON.

user1684140
  • 444
  • 6
  • 18

1 Answers1

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