Allan A
Allan A

Reputation: 437

Why can’t RSelenium press this button?

I’m trying to automate browsing on a site with RSelenium in order to retrieve the latest planned release dates. My problem lies in that there is an age-check that pops up when I visit the URL. The page(age-check-page) concists of two buttons, which I haven’t succeeded to click on through RSelenium. The code that I use thus far is appended below, what is the solution for this problem?

#Varialble and URL
s4 <- "https://www.systembolaget.se"

#Start Server
rd <- rsDriver()
remDr <- rd[["client"]]

#Load Page
remDr$navigate(s4)
webE <- remDr$findElements("class name", "action")
webE$isElementEnabled()
webE$clickElement()

Upvotes: 3

Views: 124

Answers (1)

jdharrison
jdharrison

Reputation: 30425

You need to more accurately target the selector:

#Varialble and URL
s4 <- "https://www.systembolaget.se"

#Start Server
rd <- rsDriver()
remDr <- rd[["client"]]

#Load Page
remDr$navigate(s4)
webE <- remDr$findElement("css", "#modal-agecheck .action.primary")
webE$clickElement()

Upvotes: 3

Related Questions