【发布时间】:2019-08-07 05:13:43
【问题描述】:
我想使用 RSelenium 从网页中删除一个 div 元素。这是一个 MWE,我想在其中删除 <div id="header">。我可以找到元素。我怎样才能让它消失?
MWE
library(RSelenium)
url <- 'https://ropensci.org'
## These two lines will pull the latest docker image of firefox and run it
system("docker pull selenium/standalone-firefox:latest")
system("docker run -d -p 4445:4444 selenium/standalone-firefox:latest")
drvr <- RSelenium::remoteDriver(port = 4445L)
drvr$open()
drvr$navigate(url)
drvr$screenshot(display = TRUE)
drvr$findElement("xpath", '//div[@id="header"]')
更多上下文
我有一个网页,其中 div 标题浮动(而不是固定在顶部),因为我正在展开折叠的复选框,然后单击复选框。该 div 标题妨碍单击其他元素。
【问题讨论】:
标签: r web-scraping rselenium