如何 select RSelenium 中的下拉选项?

How do I select dropdown option in RSelenium?

我正在尝试抓取 https://webgate.ec.europa.eu/competition/transparency/public/search/results,但卡在了 selecting 个国家/地区之后的第二页。 我想 select 来自 dropbox 目标 - 区域援助计划、中小企业和创业援助。

这是目前为止的代码 -

remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, extraCapabilities = fprof )
remDr$open()


#regular r vest






## Downloading Cartels

remDr$navigate("https://webgate.ec.europa.eu/competition/transparency/public?lang=en")  # load search page 
morereviews <- remDr$findElements(using = "css", "#selectAll") 
morereviews[[1]]$clickElement()
morereviews <- remDr$findElements(using = "css", ".button-search")  
morereviews[[1]]$clickElement()
morereviews <- remDr$findElements(using = "css", "#currency-EUR")  
morereviews[[1]]$clickElement()
remDr$screenshot(display = TRUE)

按照这个,我可以点击下拉框但不能select选项,任何帮助将不胜感激,谢谢!

此 ui 元素用于输入,因此您可以:

library(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4444)
remDr$open()

remDr$navigate("https://webgate.ec.europa.eu/competition/transparency/public?lang=en")  # load search page 
morereviews <- remDr$findElements(using = "css", "#selectAll") 
morereviews[[1]]$clickElement()
morereviews <- remDr$findElements(using = "css", ".button-search")  
morereviews[[1]]$clickElement()
morereviews <- remDr$findElements(using = "css", "#currency-EUR")  
morereviews[[1]]$clickElement()

morereviews <- remDr$findElements(using = "css", "#objectives-input") 
morereviews[[1]]$clickElement()
morereviews[[1]]$sendKeysToElement(list("reg", selKeys$down_arrow, selKeys$enter))
morereviews[[1]]$sendKeysToElement(list("sme", selKeys$down_arrow, selKeys$enter))
morereviews[[1]]$sendKeysToElement(list("aid for start", selKeys$down_arrow, selKeys$enter))
remDr$screenshot(display = TRUE)