【问题标题】:Why can’t RSelenium press this button?为什么 RSelenium 不能按下这个按钮?
【发布时间】:2017-05-15 10:35:55
【问题描述】:

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

【问题讨论】:

    标签: r rselenium webautomation


    【解决方案1】:

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

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

    【讨论】:

    • 非常感谢 jdharrison!
    猜你喜欢
    • 2020-06-12
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 2011-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多