Yesterday I gave a webinar on the Rselenium package to the OC-RUG. When I published RSelenium on CRAN Ray DiGiacomo the president of OC-RUG was kind enough to invite me to present RSelenium and that webinar was held on the 21st of May. I would like to thank OC-RUG and Ray in particular for the opportunity.
I will use this blog to present the video of the webinar and also for a bit of bookkeeeping. Firstly I would like to return to two of the questions asked in the Q&A.
In the seminar I suggested that the Selenium webdriver returned the png in a base 64 encoded format. I tried to save the output to file using writeBin
and remarked that I probably needed to decode the output. So here is what I should have done:
In the seminar I remarked that the google chrome browser had hundreds of startup options. They are actually termed command line switches. The two I was after were --user-data-dir
and --profile-directory
. It would then have been sufficient to use:
I added the above functionality to RSelenium. So now the screenshot
method of the remoteDriver
class has an optional file
argument. If display
is FALSE
and a file
argument is given RSelenium
will now save the png
to file.
Secondly there is now a getChromeProfile
utility function in a similar vein to the existing getFirefoxProfile function. The function is documented in the RSelenium package. Its basic usage is as follows:
# example from windows using a profile directory "Profile 1"
dataDir <- "C:\\Users\\john\\AppData\\Local\\Google\\Chrome\\User Data"
cprof <- getChromeProfile(dataDir, "Profile 1")
remDr <- remoteDriver(browserName = "chrome", extraCapabilities = cprof)
So it takes two arguments: a users chrome data directory and the profile directory within that data directory from which you want to run.
I will update the version of RSelenium
on CRAN in the coming weeks. If you would like to run the dev version with added features you can install it with:
and remember to file any issues you may have. to github so RSelenium
can improve as a package :).
At the end of the webinar the simple test on the shinytestapp was ran against multiple OS and browsers using Sauce Labs as an external provider for the selenium server and the browsers. These test results can be seen bu navigating to the RSelenium Sauce Labs page https://saucelabs.com/u/rselenium0 and searching for OCRUG TEST 1
in the search session name panel.
I have shot an extended version of the webinar with the fabled missing javascript
example which follows:
And finally I have posted the slides for the webinar to github. Please find them at http://johndharrison.github.io/RSOCRUG. There are also some R scripts contained in the master branch of the github project: https://github.com/johndharrison/RSOCRUG
Hopefully that ties up any loose ends. It was great fun preparing the webinar. I enjoyed giving it and I’m gratefully to everyone who attended.