how-to use addCustomRequestHeader properly

前端 未结 2 751
感情败类
感情败类 2021-01-13 15:42

I\'m trying to add headers into my HTTP request for a particular test case. That\'s very important since I\'m trying to test an application meant to be used in

2条回答
  •  梦毁少年i
    2021-01-13 16:06

    You need to make sure that you're using Selenium as a proxy server. I've written up an article on how to use addCustomRequestHeader in order to support basic authentication. You should be able to extrapolate the relevant portions (note I used Ruby, but it maps to other languages just as well):

    http://mogotest.com/blog/2010/06/23/how-to-perform-basic-auth-in-selenium

    One thing you very much need to be aware of is that there is no way to remove the request header. It's always additive and it's added for every request. If you need to use different headers, you'll need to restart the Selenium server.

提交回复
热议问题