簡體   English   中英

Selenium Python 使用 Chromedriver 獲取 PDF 的高度

[英]Selenium Python get height of PDF using Chromedriver

我正在嘗試使用 Chromedriver Selenium + Python 獲取 pdf 文件的滾動高度。 這是代碼:

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.adobe.com/content/dam/acom/en/accessibility/products/acrobat/pdfs/acrobat-x-accessibility-checker.pdf")
total_height = driver.execute_script("return Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );")

output 是925但是,總滾動高度應該大於 pdf 有 7 頁......想法?

我得到 969:

return $('[type="application/pdf"]').scrollHeight

暫無
暫無

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

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