在量角器的browser.get()请求中添加标头 [英] Adding headers in browser.get() requests in protractor

查看:176
本文介绍了在量角器的browser.get()请求中添加标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在标头中添加cookie,以便在使用量角器进行测试时进行自动授权,但是我不知道如何做到这一点…… 如何将自定义标头添加到browser.get()请求?

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 ?

推荐答案

Selenium(WebDriver)不支持此功能.解决此问题的一种方法是使用中间代理并沿行操纵标头.请记住,此解决方案对于HTTP来说非常完美,但是如果您使用HTTPS(在大多数情况下不可行),则将需要一些其他解决方法.

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).

这篇关于在量角器的browser.get()请求中添加标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆