简体   繁体   English

Selenium Python 使用 Chromedriver 获取 PDF 的高度

[英]Selenium Python get height of PDF using Chromedriver

I'm trying to get the scroll height of a pdf file using Chromedriver, Selenium + Python.我正在尝试使用 Chromedriver Selenium + Python 获取 pdf 文件的滚动高度。 Here is the code:这是代码:

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 );")

The output is 925 however, the total scroll height should be more than that as the pdf has 7 pages... thoughts? output 是925但是,总滚动高度应该大于 pdf 有 7 页......想法?

I am getting 969:我得到 969:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM