inst/examples/elementSendKeys.R

# example for elementSendkeys and elementClear and elementClick
remDr <- remoteDr()
remDr %>% go("https://www.google.com/ncr")
remDr %>% getTitle()
# usually google names its search box name="q"
webElem <- remDr %>% findElement("name", "q")
webElem %>% elementSendKeys("Q project")
webElem %>% elementClear()
webElem %>% elementSendKeys("R project", key = "enter")
webElem %>% elementClear()
# this time click the search button
webElem %>% elementSendKeys("R project")
searchButton <- remDr %>% findElement("xpath", "//button[@value='Search']")
searchButton %>% elementClick

# for now google urls search returns are designated h3[@class = 'r']

firstResult <- remDr %>% findElement("xpath", "//h3[@class = 'r']")
firstResult %>% elementClick

remDr %>% deleteSession()

Try the seleniumPipes package in your browser

Any scripts or data that you put into this service are public.

seleniumPipes documentation built on May 2, 2019, 5:57 a.m.