我正在使用 Protractor 来测试需要自定义 header 的应用程序。 我在 Chrome 中使用这个“修改标题”扩展。如何在 Protractor 中设置它们?
最佳答案
由于 Webdriver 的限制,实际上不可能添加自定义 header 。 Protractor 和 Selenium 出现了一个问题,请引用这个帖子:https://github.com/angular/protractor/issues/740 :
Protractor (and webdriver, which it is built on top of) are intended to test your application like a user interacting with your page, so the meaning of browser.get is something like 'do what would happen if a user opened up a new tab and entered this URL'. So, there's no way to interact with under the hood things like setting headers, except for in the way that it would normally get done for your user.
希望有帮助。
关于angularjs - Protractor 添加请求 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40628350/