为什么RSelenium不能按此按钮?(Why can’t RSelenium press this button?)

编程入门 行业动态 更新时间:2024-10-28 13:21:18
为什么RSelenium不能按此按钮?(Why can’t RSelenium press this button?)

我正在尝试使用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()

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

最满意答案

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

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

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

更多推荐

本文发布于:2023-07-17 04:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1139215.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按此   按钮   RSelenium   press   button

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!