Thursday, 22 May 2014

Orange County R Users Group (OC-RUG): RSelenium Webinar

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 bookkeeping. Firstly I would like to return to two of the questions asked in the Q&A.

Q&A question 2 and 3

How would you save a screenshot to file using RSelenium?

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:

How would you use a chrome profile?

In the seminar I remarked that the google chrome browser had hundreds of start up 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:

Added to RSelenium

I add 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: