How to select option from dropdown using Rselenium

I do not know how to select year 2018

library(RSelenium)
driver = rsDriver(
  port = 4857L,
  browser = c("firefox"))

remDr <- driver[["client"]]
remDr$navigate("https://publicadministration.un.org/egovkb/en-us/Data-Center")

# Need to edit this line
remDr$findElement("xpath", "//select[@id='dnn_ctr633_Dispatch_Index_ddlYear']/option[@value='2018']")$clickElement()

remDr$findElement("id", "dnn_ctr633_Dispatch_Index_btnSubmit")$clickElement()

1 Like

You need make click in year box and next select the specific year:

# with xpath

remDr$findElement("xpath", '//*[@id="dnn_ctr633_ModuleContent"]/div/div/div[1]/div[1]/div/button')$clickElement()

# select 2018
remDr$findElement("xpath", '//*[@id="Body"]/div[1]/ul/li[3]/label')$clickElement() # in [3] is for 2018.

# next you need put cilck in update bottom in the page for load the new filter.
remDr$findElement("xpath", '//*[@id="dnn_ctr633_Dispatch_Index_btnSubmit"]')$clickElement() 

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.