I am interested in the stats in the English Premier League. So, I try to get data from this official site https://www.premierleague.com/stats/top/players/total_pass
I am using R and RSelenium package.
library(rvest)
library(httr)
library(RSelenium)
remDr <- remoteDriver(port = 4445L)
remDr$open()
remDr$navigate('https://www.premierleague.com/stats/top/players/total_pass')
getsource <-remDr$getPageSource()
name<- read_html(getsource[[1]]) %>% html_nodes("strong") %>% html_text()
But I got the some problems. There are some categories of data such as seasons, positions, clubs and so on.
So, I thought that I can get data based on these categories. But I did not know how to select specific things in the dropdown box using Rselenium in this site.
I thought that filenElement
and clickElement
are useful functions for this. However, I do not know how I should handle these functions to select specific conditions such as 2016/17 season and Goalkeeper position.
Please give me an advice for this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…