2

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"))
johnrroby
  • 88
  • 8
  • If you use `splashr` you can use `render_har()` and get every single thing the page loads as a set of accessible components. You can also use `render_html()` to get all the HTML content from the page. – hrbrmstr Sep 20 '17 at 13:44

1 Answers1

3

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.

Andrey Kolyadin
  • 1,301
  • 10
  • 14
  • 1
    Thank you, control-a works with your code but control-s and control-u (view source) do not. I'm running a Chrome browser, but same results with Firefox. – johnrroby Sep 20 '17 at 14:20