Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could this work with Rselenium? #4

Open
vnijs opened this issue Apr 11, 2015 · 6 comments
Open

Could this work with Rselenium? #4

vnijs opened this issue Apr 11, 2015 · 6 comments

Comments

@vnijs
Copy link

vnijs commented Apr 11, 2015

listviewer is really cool! I thought this would be great fit for Rselenium because it creates some difficult to navigate lists. I tried it out but get a bunch of warnings (see below) but no listviewer. Any ideas?

library(RSelenium)
pJS <- phantom()
remDr <- remoteDriver(browserName = 'phantomjs')
remDr$open(silent = TRUE)
remDr$navigate("http://vnijs.rady.ucsd.edu:3838/marketing")
webElems <- remDr$findElements("css selector", "label")
jsonedit(webElems)
remDr$close()
pJS$stop() 

Warning messages:
1: In FUN(X[[28L]], ...) :
converting an R function to JSON as null. To change this, define a method for toJSON() for a 'function' object.

@timelyportfolio
Copy link
Owner

It definitely can work, but RSelenium is loading RJSONIO and the not 28 pull request htmlwidgets does also, so I'm thinking that we'll need to explicitly call jsonlite::toJSON. jsonlite supports conversion of functions. Could you try this? Note, it might affect your shiny, but you can easily revert back.

devtools::install_github(c('jeroenooms/jsonlite', 'rstudio/shiny', 'yihui/htmlwidgets@jsonlite'))

@vnijs
Copy link
Author

vnijs commented Apr 11, 2015

I took another look at the list created by RSelenium. Link to a webElems list in an rda file linked below. This is much more complicated than I hoped. It is a list but each element is an S4 object with functions all over the place.

In case he is interested ... @johndharrison ... any thoughts on using listviewer with output lists from Rselenium? Figuring out what Rselenium scraped, where the result is, and how to retrieve it is not always clear to me so I thought a list viewer might be useful.

https://www.dropbox.com/s/meracyap2rskql7/webElems.rda?dl=0

@timelyportfolio
Copy link
Owner

@abresler might also be interested in this

@abresler
Copy link

Yup!!

@abresler
Copy link

Other thing we need to do is wrap a tor option into rselenium I have hacks but it'd similar how we do elastic search but wanna try to avoid having to use terminal

@johndharrison
Copy link

Hi Guys,

Sounds interesting. When I began RSelenium only RJSONIO was available. For some private projects I have worked on I have used jsonlite and prefer it. I would think it could be a drop in replacement in the RSelenium code. I havent used listviewer but from the demo it looks neat.

@abresler if you can file an issue on RSelenium I can look into tor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants