我正在尝试提取价值的一个隐藏的输入的标签。 虽然元素存在于HTML我找不到它与bs4。
这是错误的消息,我会得到:
AttributeError: 'NoneType' object has no attribute 'find'
这是html网页上:
<form id="exampleid" class="exampleclass" action="/ex/ex-ex/ex/2" method="post">
<more html>
<div>
<input type="hidden" name="csrf" value="abcdefghijklmnopqrstuvwxyz">
</div></form>
这是我的前代码:
csrf = soup.find("form", {"id": "exampleid"})
csrf = csrf.find('input', {'name': 'csrf'}).get("value")
print(csrf)
我将感谢任何形式的帮助,因为它是真正困扰我的。 谢谢你提前!