How to use shortcuts with RSelenium

47 Views Asked by At

How are shortcuts used in RSelenium?

In the example below, I use a common shortcut to display the browsing history in Firefox. That is: push and hold Control key + press H key.

While the shortcut works just fine if one presses the keys manually, it does not work when done with Rselenium. Anyone?

library(RSelenium)
rD <- rsDriver(browser = "firefox") 

remDr <- rD$client
remDr$navigate("https://www.google.com")

remDr$navigate("https://www.amazon.com")

elem <- remDr$findElement("xpath", "//body")
elem$sendKeysToElement(list(key = 'control',  'H'))

#here is another example with three keys. 
#the reload shortcut control+shift+R
elem$sendKeysToElement(list(key = 'control',  key = 'shift','R'))

#it is very intriguing that the select all shortcut, control + a, works well.
webElem$sendKeysToElement(list(key = "control", "a"))
0

There are 0 best solutions below