簡體   English   中英

使用 Beautiful Soup/Selenium 對動態表進行增補時,我無法獲得完整的 html 代碼

[英]I can't get full html code when souping a dynamic table using Beautiful Soup/Selenium

我在用 Beautiful soup/Selenium 給動態表加湯時遇到了麻煩

當我運行代碼時,我無法在筆記本中獲取整個 html 代碼。

我感興趣的標簽位於標簽“框架集”下,我應該以某種方式“打開”。 我怎么能這樣做?

driver = webdriver.Chrome('/Users/Administrador/Documents/chromedriver')
main_url = 'https://www.justiciacordoba.gob.ar/Estatico/JEL/Escrutinios/ReportesEleccion20190512/default.html'
driver.get(main_url)
soup = BeautifulSoup(driver.page_source, 'lxml')
soup

output : <html><head></head><frameset border="0" cols="*" frameborder="NO" framespacing="0" id="fset" rows="190,*">
<frame name="topFrame" scrolling="NO" src="Index.html"/>
<frame align="center" name="mainFrame" src="about:blank"/>
</frameset><noframes></noframes>
</html>

更改驅動程序的框架並存儲該值:

driver.switch_to.frame(driver.find_element_by_name("topFrame"))
frame_source = driver.page_source

frame_source 變量應該存儲 iframe 的源代碼。 我檢查了網站,iframe 的名稱是“topFrame”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM