Elen Elen - 2 months ago 27
R Question

Selenium no such element found

I try to take the href from an element using RSelenium.

Here is an example of html structure:

<ol id="rem">
<div class="bare">
<h3>
<a class="tlt mhead" href="https://www.myexample.com">


I use this:

pro<-remDr$findElement(using = 'xpath', "//*/input[@class = 'bare']")
pro$highlightElement()


but it can't find the element and returns this error:

Error: Summary: NoSuchElement
Detail: An element could not be located on the page using the given search parameters.
class: org.openqa.selenium.NoSuchElementException


What can I do?

Answer

Not the input element has the bare class, the div (assuming dib is a typo):

//div[@class='bare']/h3/a