Adding headers in browser.get() requests in protra

2019-02-24 23:18发布

问题:

i want to add cookies in headers for automatic authorization in test with protractor, but there is no native way to do this, how i understand... How can i add custom headers to browser.get() request ?

回答1:

Selenium (WebDriver) does not support this. One way of solving this is by using a intermediate proxy and manipulating the headers along the line. Keep in mind that this solution works perfectly fine for HTTP, but will will require some additional workarounds if you are using HTTPS (and in most cases isn't viable).