setting request headers in selenium

后端 未结 9 1215
青春惊慌失措
青春惊慌失措 2020-11-29 21:53

I\'m attempting to set the request header \'Referer\' to spoof a request coming from another site. We need the ability test that a specific referrer is used, which returns a

9条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 22:39

    check this out: chrome_options = Options()

    chrome_options.add_argument('--headless')
    chrome_options.add_argument('user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"')
    

    Problem solved!

提交回复
热议问题