简体   繁体   中英

RSelenium issue when selecting from dropdown menu

I've looked and tried all possible alternatives found in other questions about dropdown menus with RSelenium. However for some reason none of them get this issue solved.

I'm trying to fill a form on this page consisting of 2 dropdown menus and 2 date selectors + a button press. I can't get past the first dropdown of "Empresa"

I've managed to select the appropiate element but when clicking nothing happens. Also, cannot replicate the behavior of a manual click in a Selenium click.

Hopefully someone has an insight I can apply.

library(tidyverse)
library(RSelenium)

link <- "https://www.smv.gob.pe/Frm_EVCP?data=5A959494701B26421F184C081CACF55BFA328E8EBC"
driver <- rsDriver(browser="firefox", port=4545L)
remote_driver <- driver[["client"]]
# remote_driver$open()
remote_driver$navigate(link)

Credicorp_SAF <- remote_driver$findElement(using = "xpath",value = '/html/body/form/div[3]/div[2]/div/div[2]/div[2]/div[2]/div[2]/div[2]/select/option[contains(text(), "CREDICORP CAPITAL")]')
Credicorp_SAF$clickElement() #Nothing happens in the open browser
Credicorp_SAF$getElementText() #Verifying it's the correct one

The page uses jQuery. You can trigger that from javascript with:

$('[name="ctl00$MainContent$cboDenominacionSocial"]').val("124863")
$('[name="ctl00$MainContent$cboDenominacionSocial"]').trigger('change')

I'm not sure how to execute that in RSelenium, apparently it's something like:

remDr$executeScript(script, args = list("dummy"))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM