taking screenshot with RSelenium and phantomjs

34 Views Asked by At

I want to take screenshot from youtube using RSelenium and phantomjs. I have this code:

library(RSelenium)
library(wdman)
rPJS <- wdman::phantomjs(port = 4680L)
rPJS$process$is_alive()
rJS <- RSelenium::remoteDriver(browserName="phantomjs", port=4680L)
rJS$open()

rJS$navigate("https://www.youtube.com/watch?v=fKc050dvNIE")
rJS$getTitle()
rJS$screenshot(file = 'test.png')
rJS$close()
rPJS$stop()

Everything seems to work fine, however the image test.png looks like this:

enter image description here

I tested it with "https://www.google.com" and the image looks fine:

enter image description here

Any idea how to make it work for youtube? Thanks.

0

There are 0 best solutions below