2

I want to block all the 3rd party crap(like faceboook and google analytics api) during the page load to speed up the execution. Many has suggested using proxy is the best way to do that.

Has any one done this before? And can you please suggest me how can I implement the proxy and blacklist urls in protractor and Jasmine test framework.

eLRuLL
  • 17,114
  • 8
  • 67
  • 91
Galileo123
  • 143
  • 3
  • 15
  • maybe you could try something like `protractor-http-mock`](https://github.com/atecarlos/protractor-http-mock) but I am not sure it works for 3rd-party requests. – eLRuLL Dec 29 '17 at 19:28

1 Answers1

1

Using a proxy seems reasonably straightforward. On the Protractor side, you just need to configure the proxy configuration parameter in your capabilities, e.g.:

capabilities: {
    browserName: 'chrome',
    proxy: {
      proxyType: 'manual',
      httpProxy: 'ip:port',
      sslProxy: 'ip:port',
      autodetect: 'false'
    }
}

Then, decide on what proxy software to use. For example, BrowserMob-proxy has a built-in support for white- and black- listing. Here are some materials to get you started:

alecxe
  • 414,977
  • 106
  • 935
  • 1,083