【发布时间】:2020-11-01 07:13:45
【问题描述】:
我正在使用 Python 3.7 和 Django 3。我目前使用以下代码生成具有给定 URL 的 Web 浏览器
filePath = '/tmp/cat_and_dog.webp'
searchUrl = 'http://www.google.hr/searchbyimage/upload'
multipart = {'encoded_image': (filePath, open(filePath, 'rb')), 'image_content': '', }
response = requests.post(searchUrl, files=multipart, allow_redirects=False)
fetchUrl = response.headers['Location']
webbrowser.open(fetchUrl)
如何获取渲染的 DOM 的 HTMl?请注意,这与“查看源代码”显示的内容不同。我对在浏览器中运行“检查元素”时看到的 DOM 版本更感兴趣。我可能使用了不正确的术语,但希望它清楚我希望提取浏览器呈现的实际 HTML。
【问题讨论】:
标签: python html django render python-webbrowser