【发布时间】:2019-08-08 21:15:03
【问题描述】:
我正在尝试在此网站https://www.coindesk.com/ 上重现此帖子Issue scraping page with "Load more" button with rvest 中所选答案的代码。但是,以下行给出了错误:
#original
#load_btn <- ffd$findElement(using = "css selector", ".load-more .btn")
#modified
load_btn <- ffd$findElement(using = "css selector", ".load-more-stories .btn")
Selenium 消息:无法定位元素:load-more-stories For 有关此错误的文档,请访问: https://www.seleniumhq.org/exceptions/no_such_element.html 构建信息: 版本:'4.0.0-alpha-2',修订:'f148142cf8',时间: '2019-07-01T21:30:10' 系统信息:主机:'LAPTOP-sdsds9L',ip: 'sdssd',os.name:'Windows 10',os.arch:'x86',os.version: '10.0', java.version: '1.8.0_211' 驱动信息:driver.version: 未知
错误:摘要:NoSuchElement 详细信息:一个元素不能 使用给定的搜索参数位于页面上。班级: org.openqa.selenium.NoSuchElementException 更多细节:运行 errorDetails 方法
我根据第 449-452 行假设了按钮名称:
</div>
<div id="load-more-stories">
<button>Load More Stories</button>
</div> </div>
知道如何正确调整此策略吗?
【问题讨论】:
标签: html r web-scraping rselenium