2
我想在RSelenium
和Xpath
的頁面中找到PDF文件的所有鏈接。RSelenium:通過Xpath查找鏈接
請考慮
require(RSelenium)
RSelenium::checkForServer()
RSelenium::startServer()
remDr <- remoteDriver()
remDr$open()
remDr$navigate("https://cran.r-project.org/manuals.html")
在頁面上有多個鏈接到PDF文件,如
<a href="doc/manuals/r-release/R-intro.pdf">PDF</a>
但我的第一次嘗試
remDr$findElement(using = "xpath", "//a[contains(@href,'.pdf')/@href")
產生以下錯誤
Error: Summary: InvalidSelector
Detail: Argument was an invalid selector (e.g. XPath/CSS).
class: org.openqa.selenium.InvalidSelectorException
我的語法錯了嗎?