【问题标题】:how to use R-selenium to click a expand list如何使用 R-selenium 点击展开列表
【发布时间】:2020-07-24 14:45:52
【问题描述】:

现在我正在尝试从this website 抓取数据。我想用 selenium 点击 this"View all updates" button。我使用 SelectorGadget 和 XPath helper 来找到它的 css 选择器和 xpath,但两者都失败了。 我的代码如下:

loadmore <- remDr$findElement(using = 'css selector', ".js-toggle-expand-updates")
loadmore <- remDr$findElement(using = 'xpath', "//*div[@class='js-toggle-expand-updates']")
loadmore$clickElement()

【问题讨论】:

    标签: web-scraping rselenium


    【解决方案1】:

    我自己找到了答案。通过SelectorGadget找不到按钮的excat类,是下面代码中class的第一个词

    <div style="cursor: pointer;" class = "box box-basic type-s pbxxs mbn mtm xs-mts phm xs-phs bg-brighter border-none-a-xs js-toggle-expand-updates"> 
    

    这是“盒子”

    【讨论】:

      猜你喜欢
      • 2019-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-29
      • 1970-01-01
      • 2021-08-18
      • 2015-01-02
      相关资源
      最近更新 更多