问题
Let's say I want to select all on a page, copy all or save a page, what is the proper command for RSelenium? The example below seems to press the keys in sequence, what I'm trying to do is tell it to hold the "control" key while it presses "s"
library(RSelenium)
driver <- rsDriver()
remDr <- driver[["client"]]
remDr$navigate("https://www.google.com/")
remDr$sendKeysToActiveElement(list(key = "control", "s"))
回答1:
You need to choose element first:
webElem <- remDr$findElement("css", "html")
webElem$sendKeysToElement(list(key = "control", "s"))
Tested it with list(key = "control", "a")
and looks like such construction should work as simultaneous keys.
来源:https://stackoverflow.com/questions/46322715/how-to-press-two-keys-simultaneously-i-e-control-s-in-a-webpage-using-rselen