'RSelenium can't select an option from a drop-down menu

I'm trying to select an option from a drop-down menu using RSelenium. Although my codes can find and click elements without an error warning, the option is not actually selected - the page still uses the default option.

The website I'm trying to scrape is:

url <- 'https://wrlc-gu.primo.exlibrisgroup.com/discovery/search?vid=01WRLC_GUNIV:01WRLC_GUNIV&mode=advanced'
remDr$navigate(url)

The codes I use to find and click the drop-down menu are:

# activate the first drop-down menu
frame <- remDr$findElement('xpath', '/html/body/primo-explore/div/prm-explore-main/div/prm-search-bar/div[1]/div/div[2]/div/prm-advanced-search/form/div/div[2]/md-card[1]/div[1]/fieldset/div[1]/md-input-container[1]/md-select')
frame$clickElement
Sys.sleep(2)
# choose the third option (creator/author)
remDr$findElement('css', '#select_option_51')$clickElement
remDr$screenshot(display = TRUE)

There is no error warning, but the screenshot shows the option is not selected after the codes. I am using chrome via docker.

I'm very new to web-crawling and appreciate any help! Thanks!



Solution 1:[1]

Using xpath worked.

remDr$findElement(using ="xpath", '//*[@id="select_option_55"]/div[1]/span')$clickElement()

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nad Pat