简体   繁体   中英

executeScript from RSelenium gives error with args

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?

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"))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM