1

I am trying to scrape data from this webpage: https://www.premierleague.com/stats/top/players/saves however there are two pages of data i want to scrape. I have been able to scrape the first page of data with the code below:

remDr$navigate("https://www.premierleague.com/stats/top/players/saves")

epl <- read_html(remDr$getPageSource()[[1]])

rank <- epl %>% html_nodes(".statsTableContainer .rank") %>%  html_text()
player <- epl %>% html_nodes(".playerName ") %>%  html_text()
club <- epl %>% html_nodes(".statNameSecondary") %>%  html_text() 
stat <- epl %>% html_nodes(".statsTableContainer .text-centre") %>%  html_text()
str(rank)
str(player)
str(club)
str(stat)

Saves <- data.frame(rank, player, club, stat)

I have been using the RSelenium pkg for the scraping. For the second page there isn't a different URL you have to click the arrow on the side. How do i scrape the second page when there's only an arrow to select?

I haven't been able to try anything as i'm not sure where to even start as i've not come accross this problem before.

Phil
  • 7,287
  • 3
  • 36
  • 66
Tony H
  • 25
  • 2
  • Have you looked at this question: https://stackoverflow.com/questions/43307090/how-to-select-dropdown-box-using-rselenium or this one: https://stackoverflow.com/questions/50310595/data-scraping-in-r – Dave2e Oct 29 '22 at 13:42

0 Answers0