隐藏的元素不会在响应中发送- Python请求/BeautifulSoup

2024-09-30 12:11:30 发布

您现在位置:Python中文网/ 问答频道 /正文

在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


Tags: httpscomliveurl源代码htmlloginrequests

热门问题