Web scraping in R using Rselenium and inputs

Hello,

I have this code for web scraping in R using Rselenium. It works for a static example. But I want to make it works for more inputs. Let's say I have a data frame in R named Data with 2 columns: one for CNP and one for VIN with 1000 rows . How can I scraping in this case? I tried with option$sendKeysToElement(Data$CNP) but didn't work. I tried also with a for sentence, no result, just errors.

This is my code:

rD <- rsDriver(browser = c("chrome"),port = 4444L,chromever = "83.0.4103.39") #specify browser type you want Selenium to open
remDr <- rD$client
#remDr$open()
remDr$navigate("https://test2.wais.groupama.ro/bdrcas/bdr_cas/bdr_cas_operatii/istoric") # navigates to webpage

# select first input field
option <- remDr$findElement(using='id', value="BdrCasCnp")
option$highlightElement()
option$clickElement()
option$sendKeysToElement(list("29902999202"))

# select second input field
option <- remDr$findElement(using='id', value="BdrCasVin")
option$highlightElement()
option$clickElement()
option$sendKeysToElement(list("UU1KSDAFH36474825"))

#press key
webElem <- remDr$findElement(using = 'css', "#BdrCasIstoricForm > div.row > div > div > div:nth-child(3) > button > span:nth-child(1)")
webElem$highlightElement()
webElem$clickElement()

text <- remDr$findElement(using = "id", value = "BdrCasIstoricForm")
x = text$getElementText()
print(x)

My url is private, unfortunatley. Any idea, please?

Thank you.

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