I am trying to use RSelenium to remotely interact with a webpage in Chrome:
remDr <- remoteDriver(browserName = "chrome")
remDr$open()
remDr$navigate("http://database.globalreporting.org/search")
textBox <- remDr$findElement("id", "search-report-field")
textBox$sendKeysToElement("Company Name")
Specifically, I want to be able to send keystrokes to the textbox on this page labeled "Search by organization name" (the textbox id is "search-report-field"). I am able to perform various actions on the element (highlight, click, etc...), but sendKeysToElement throws the following error:
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: java.lang.ClassCastException
Any idea what might be causing the problem and how to fix it?
The keys need to be given as a list for example:
textBox$sendKeysToElement(list("some Text", key = "enter"))
For your example:
library(RSelenium)
# running
# docker run -d -p 5901:5900 -p 127.0.0.1:4444:4444 selenium/standalone-chrome-debug:2.53.0
remDr <- remoteDriver(browserName = "chrome")
remDr$open()
remDr$navigate("http://database.globalreporting.org/search")
textBox <- remDr$findElement("id", "search-report-field")
textBox$sendKeysToElement(list("Company Name"))
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.