RSelenium: Find link with Xpath
There is a syntax error inside your expression, missing a closing ]
:
//a[contains(@href,'.pdf')]/@href HERE^
But, even if you fix it, you'll get an error - a different one this time. This is because XPath expressions in selenium have to point to web elements and not element attributes. In other words, use //a[contains(@href,'.pdf')]
to find an element and then get_attribute
method to get the href
attribute value.
Note that you may also find the link by link text:
remDr$findElement(using = "link text", "PDF")