r - lapply function with RSelenium -


my session this:

startserver() remdir <- remotedriver() remdir$open() source <- paste0("https://www.example.com") remdir$navigate(source) 

i parsing link:

html   <- remdir$getpagesource() tmp    <- xpathsapply(htmlparse(html[[1]]),                           ' //a/@href') 

and want parse each tmp link:

srcpartone <- paste0(source, as.list(tmp)[185:199],"/") htmls      <- lapply(srcpartone, geturl) 

but in point, geturl function not usage me. because links contains dynamic page. so, need use rselenium in lapply function this:

htmls      <- lapply(srcpartone, remdir$navigate,remdir$pagesource) 

i gave example, know doesn't work. how can parse each link using rselenium? edit :

library(rselenium)   library(rcurl)   library(rdrop2)   library(pbapply)    #start rselenium   drop_auth()  #dropbox authentication startserver() remdir <- remotedriver() remdir$open(silent = true)  #set 'vitrin' sources mobil number: source <- paste0("https://www.sah1b1nden.com") remdir$navigate(source) html   <- remdir$getpagesource() tmp    <- xpathsapply(htmlparse(html[[1]]),                           ' //a/@href')    #get html framework each ' vitrin' sources: #  srcpartone <- paste0(source, as.list(tmp)[185:232],"/") pblapply(srcpartone, function(x) {   remdir$navigate(x)   remdir$getpagesource() }) -> pgs  parses<- lapply(x = pgs[1:48], htmlparse)   temp       <- lapply(parses, xpathsapply, '//*[contains(concat( " ", @class, " " ), concat( " ", "show-part", " " ))]',xmlvalue) 


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -