繁体   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