为什么 RSelenium 不能按下这个按钮?

Why can’t RSelenium press this button?

我正在尝试使用 RSelenium 自动浏览网站以检索最新的计划发布日期。我的问题在于当我访问 URL 时弹出年龄检查。页面(age-check-page)由两个按钮组成,我通过RSelenium点击没有成功。我到目前为止使用的代码附在下面,这个问题的解决方案是什么?

#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()

您需要更准确地定位选择器:

#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()