为什么PhantomJS不发送任何从AJAX请求收到的cookie?

时间:2017-01-05 15:39:32

标签: python ajax selenium cookies phantomjs

我在这里遇到网站授权问题。我在Selenium上使用无头浏览器PhantomJS。 我做了什么:

driver.get('https://foo.com')
# some instructions to log in
# foo.com makes some requests to https://bar.foo.com and sets cookies for https://bar.foo.com domain
driver.get_cookies()
# no cookies for https://bar.foo.com
# any requests to https://foo.com are not autorized because the cookies from https://bar.foo.com are the ones that are needed, but not provided

有什么解决方法吗?一直在寻找解决问题很长时间没有成功。

还有一点需要注意:例如,chromedriver会将从AJAX请求收到的所有cookie收集到子域,而phantomjs则不会这样做。

0 个答案:

没有答案
相关问题