我正在尝试使用此链接为每个国家/地区与所有与艾滋病毒/艾滋病相关的非政府组织提供表格:https ://www.unodc.org/ngo/showExtendedSearch.do
我可以导航到 url 并选择“HIV/AIDS”单选按钮。但现在我还需要为 'region' 和 'country' 的 Dropbox 提取所有值,以便我可以在循环中使用它们来按顺序对每个国家/地区的表格进行网络抓取。如何收集两个 Dropbox 的值?到目前为止,我的代码如下:
#load library
library(RSelenium)
#Specify remote driver
remDr <- remoteDriver(browserName='firefox')
#Initialise session
remDr$open()
#navigate to advanced search page
url <- "https://www.unodc.org/ngo/showExtendedSearch.do"
remDr$navigate(url)
#Click 'HIV/AIDS' filter
webElem <- remDr$findElement(using = 'css',
value = '#applicationArea > form > table > tbody > tr > td > table:nth-child(7) > tbody > tr:nth-child(2) > td > table > tbody > tr > td:nth-child(2) > table > tbody > tr:nth-child(3) > td:nth-child(4) > input[type="checkbox"]')
webElem$clickElement()