我正在尝试使用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 );")
输出是925
但是,总滚动高度应该大于此,因为 pdf 有 7 页......思潮?
我得到 969:
返回 $('[type="application/pdf"]'(.scrollHeight