i can get the content with urllib2.Request(website, data=None, headers = headers), but I cannot open the website by selenium with below scripts(
from selenium import webdriver
myff = webdriver.Firefox()
myff.add_cookie(headers)
myff.get(website)
)
********************************************
here , the headers ={
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0',
'Cookie':'_gscu_993197171=28403458i885b418; JSESSIONIDwljg=0000Nj_Thmz0a9Yvn6mdL4ApfRf:16vfceu36',
'Referer':'anotherwebsite',
'Connection':'keep-alive',
'Host':'website'}
for security reason, I replace the real website by website here.
********************************************
I used the Fiddler to see what happened:
1) In urllib2, see all key and values
2) in selenium, see {
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0',
'Connection':'keep-alive',
'Host':'website'}, the Cookies and Referer haven't been seen in Fiddler log
Why?