Web Harvesting + Dynamic HTML 다루기
# TripAdvisor_review_image ------------------------------------------------ library(rvest) library(RSelenium) library(foreach) #웹주소 # 함수 ---------------------------------------------------------------------- expandMore <- function(wdd) { eles = wdd$findElements(using='css selector','span.moreLink') a=foreach(ele=eles) %do% tryCatch(ele$clickElement(),error=function(e){}) } goNextReviewPage <- function(wdd) { result <- tryCatch({ nextBtn = wdd$findElement(using='css selector','a.nav.next') nextBtn$clickElement() return(TRUE) },error=function(e){ return(FALSE) }) result } # Headless PhantomJS ------------------------------------------------------ pjs <- phantom() # Web Harvesting ---------------------------------------------------------- url = "http://www.tripadvisor.com/Restaurant_Review-g35805-d570063-Reviews-or20-Alinea-Chicago_Illinois.html#REVIEWS" # 브라우저 열기 wd <- remo