Right-click cannot be simulated through RSelenium

Viewed 96

As I was following the instructions on the RSelenium vignette, I encountered a problem where I couldn't simulate the behavior of a right click.

driver <- rsDriver(browser = c("firefox"), port = 4568L)
remDr <- driver[["client"]] 

remDr$navigate("https://cran.r-project.org/")

webElems <- remDr$findElements(using = "tag name", "frame")

remDr$switchToFrame(webElems[[3]])

webElems <- remDr$findElements("partial link text", "Download R")
sapply(webElems, function(x) x$getElementText())

remDr$mouseMoveToLocation(webElement = webElems[[1]])
remDr$click(buttonId = 2) # unexpected behavior here

remDr$sendKeysToActiveElement(
  list(key = "down_arrow", key = "down_arrow", key = "enter")
)

The code above worked fine until remDr$click(2). When it was executed, the browser behaved the same as when a left click was performed whereas specifying buttonId = 2 should perform a right click instead. I'm wondering what causes this unexpected behavior.

Here's the info of my R version. Besides, I'm using RSelenium 1.7.7 and Firefox ver.95.0.2.

R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    
system code page: 932
0 Answers
Related