Skip to content

Does RSelenium handle hotkeys? #287

@Camilo-Mora

Description

@Camilo-Mora

I was not able to find a solution on the web about this. So I am trying here.

The question is, can RSelenium handle hotkeys? I noted that only the control + a hot key works... but all others do not.

Hotkeys is a practical solution to activate extensions, or run operations outside DOM, which are complicated to handle with Selenium...

Below I show some examples of hotkeys that should operate in any chrome browser. I put them as examples of shortcuts that work when entered manually but not when using Rselenium... they are just as reference for the problem. My particular need is to activate a Extension that uses Control+Shift+S as shortcut.

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

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

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

#use hot key to see history of visiting the two pages above.
elem <- remDr$findElement("xpath", "//body")
elem$sendKeysToElement(list(key = 'control',  'H'))

#here is another example with three keys. This one should reload the page
#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"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions