inst/examples/switchToFrame.R

remDr <- remoteDr()
remDr %>% go("https://cran.r-project.org/")
remDr %>% getTitle()
frames <- remDr %>%  getPageSource() %>% xml_find_all("//frame") %>% xml_attr("name")

# switch to main body
remDr %>% switchToFrame(frames[3])
remDr %>%  getPageSource() %>% xml_find_all("//a")
remDr %>%  getPageSource() %>% xml_find_all("//a") %>% length
#[1] 17

# switch back to main frame

remDr %>% switchToFrame()
remDr %>%  getPageSource() %>% html_structure()

# switch to side bar
remDr %>% switchToFrame(frames[2])
remDr %>%  getPageSource() %>% xml_find_all("//a")
remDr %>%  getPageSource() %>% xml_find_all("//a") %>% length
# [1] 13

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 29, 2017, 7:01 p.m.