隐藏的元素不会在响应中发送 - python requests / beautifulsoup

时间:2016-12-26 15:14:30

标签: python html beautifulsoup python-requests

在hotmails登录页面,如果你需要HTML代码,你可以看到有一些隐藏的字段。如果你后来查看了源代码,隐藏的字段就不再存在了。

问题是我需要隐藏字段的值。当我从侧面请求HTML时,如下所示:

with requests.session() as c:
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'}
    url = 'https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=13&ct=1482763638&rver=6.4.6456.0&wp=MBI_SSL&wreply=https%3a%2f%2foutlook.live.com%2fowa%2f&lc=1030&id=292841&mkt=da-dk&cbcxt=out&fl=wld'
    req = requests.post(url, data=payload, headers=headers)
    html = req.text
    soup = BeautifulSoup(html, 'html.parser')

它需要源代码的HTML ..这是一个问题。因为现在我没有得到隐藏的领域。

我该怎么办?

链接到hotmail登录(供您检查HTML):https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=13&ct=1482763638&rver=6.4.6456.0&wp=MBI_SSL&wreply=https%3a%2f%2foutlook.live.com%2fowa%2f&lc=1030&id=292841&mkt=da-dk&cbcxt=out&fl=wld

编辑:源代码中隐藏了一个,但为什么不是源代码中的所有隐藏字段,来自" expect元素"?

以下是未在源代码中显示的隐藏字段:https://gyazo.com/119fc0fe0c9f242ab705ce0c6affbec9

0 个答案:

没有答案