2

I try to reproduce an example code from here

Here is the code:

library("RSelenium")
#start RSelenium server
rD <- rsDriver(verbose = FALSE)
remDr <- rD$client
remDr$open()
remDr$navigate("http://www.google.com/ncr")
script <- "return document.getElementById('hplogo').hidden;"
remDr$executeScript(script, args = list())

and for the last line I receive this error:

Selenium message:unknown error: 'args' must be a list
  (Session info: chrome=60.0.3112.113)
  (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT 6.3.9600 x86_64)

Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     Further Details: run errorDetails method

I can't understand what happens with this error because remDr$navigate works and remDr$executeScript. What is the difference with executeScript and gives this error?

Dikonstans
  • 47
  • 8
  • try this `remDr$executeScript(script)` – Tarun Lalwani Sep 09 '17 at 06:55
  • @TarunLalwani I tried thank you but again the error is the same. – Dikonstans Sep 09 '17 at 06:57
  • 1
    This may be a bug either in RSelenium as such. I assume few things that you are on latest version of RSelneium, Chrome and Chromedriver. Also try `remDr$executeScript(script, args = list("dummy"))` – Tarun Lalwani Sep 09 '17 at 07:01
  • @TarunLalwani yes this works for the code. Not sure what has changed because when I tested it worked and after some hour I opened the PC to work again it didn't work. Your last comment is the answer helped. Thank you. – Dikonstans Sep 09 '17 at 11:55

1 Answers1

9

This may be a bug in RSelenium as such.

I assume few things that you are on latest version of RSelneium, Chrome and Chromedriver.

Use

remDr$executeScript(script, args = list("dummy"))

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265