How to select dropdown box using Rselenium?

匿名 (未验证) 提交于 2019-12-03 01:27:01

问题:

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 % 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.

回答1:

Using the following code I was able to get the browser to select the 2014/15 season. You will need to inspect the contents of the various drop-downs and expand this as required.

rD 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!