从 R 中的文本输入框中抓取默认值
我可以在这个网站上抓取表格:-
使用 RSelenium 包。
问题是上面的带圆圈的列返回为空白:-
现在,此列是可编辑的,但我只需要刮掉其默认值(例如 50.7第一行)。
我正在使用以下代码:-
library(RSelenium)
library(rvest)
library(dplyr)
driver = rsDriver(browser = c("firefox"), port = 0001L)
remDr <- driver[["client"]]
url <- 'https://dailyfantasynerd.com/optimizer/draftkings/nba'
remDr$navigate(url)
username <- remDr$findElement(using = "id", value = "input-username")
username$sendKeysToElement(list("xx"))
#send password and Enter
passwd <- remDr$findElement(using = "id", value = "input-password")
passwd$sendKeysToElement(list("xx", "\uE007"))
#get all the tables from webapage
df = (remDr$getPageSource()[[1]] %>%
read_html() %>% html_table())[[7]]
I am able to scrape the table on this Website:-
using RSelenium
package.
The issue is that the Circled Column above is returned as Blank:-
Now, this Column is editable but I only need to scrape its Default Value (for example 50.7 in the first row).
I am using the following code:-
library(RSelenium)
library(rvest)
library(dplyr)
driver = rsDriver(browser = c("firefox"), port = 0001L)
remDr <- driver[["client"]]
url <- 'https://dailyfantasynerd.com/optimizer/draftkings/nba'
remDr$navigate(url)
username <- remDr$findElement(using = "id", value = "input-username")
username$sendKeysToElement(list("xx"))
#send password and Enter
passwd <- remDr$findElement(using = "id", value = "input-password")
passwd$sendKeysToElement(list("xx", "\uE007"))
#get all the tables from webapage
df = (remDr$getPageSource()[[1]] %>%
read_html() %>% html_table())[[7]]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论