r语言 - 为什么 RSelenium 不能按此按钮



我正在尝试使用 RSelenium 自动浏览网站,以便检索最新计划的发布日期。我的问题是,当我访问 URL 时会弹出一个年龄检查。页面(年龄检查页面(包含两个按钮,我没有通过 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()

最新更新