Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does RSelenium handle hotkeys? #287

Open
Camilo-Mora opened this issue Feb 3, 2024 · 0 comments
Open

Does RSelenium handle hotkeys? #287

Camilo-Mora opened this issue Feb 3, 2024 · 0 comments

Comments

@Camilo-Mora
Copy link

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"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant