在Python中刮取第二个页面将得到第一个页面的数据。 以下是代码的相关部分:
browser.get("https://XXXXXXXXX/0_9b34?P=2")
innerHTML = browser.execute_script("return document.body.innerHTML") #type = str #returns the inner HTML as a string
Eroom_M7_htmlpage = innerHTML
soup = BeautifulSoup(Eroom_M7_htmlpage, 'html.parser') #type = bs4.BeautifulSoup
htmlprettified = soup.prettify() #type = str
project_items = soup.find_all('td', attrs={'headers' : 'ID Item'})
如果答案是初学者友好的,我将不胜感激,因为我只是一个3个月的Python自学者。 请在这件事上我真的需要帮助来完成我的项目:( ps:我看了两篇关于这个的文章,但没有帮助/理解。你知道吗
您应该返回页面源代码,而不是javascript响应
.page_source
是您要使用的方法。你知道吗所以执行你想要的JavaScript,然后捕获HTML
而不是
innerhtml
文档->;HERE硒使用的一个基本例子。你知道吗
相关问题 更多 >
编程相关推荐