【发布时间】:2017-06-01 20:45:37
【问题描述】:
我正在尝试学习如何使用 Selenium 的 IE 驱动程序阅读 PDF 中的文本。我收到 selenium.common.exceptions.NoSuchElementException: Message: Unable to find element with css selector == body
from selenium import webdriver
import time
TO_url = "Y:\Work\Work\PFCToolbox\exampleTO\HT072663_001.pdf"
vpc_url = "http://dspgot03.vcc.ford.com/apps/vpc/vpc.nsf/"
driver = webdriver.Ie()
driver.get(TO_url)
element = driver.find_element_by_css_selector("body")
time.sleep(10)
我也尝试使用其他 driver.find_element_by 函数,但找不到有效的函数
【问题讨论】:
-
您有示例网址吗?
-
您可能想要下载 pdf,然后使用
pdfrw等库来阅读其内容。