I'm attempting to download a PDF in a page via right-click and selecting "save as", but I'm clearly not doing something right, as the right-click menu pops up but the arrow moves do not happen.
Any advice welcome.
EDIT: Sorry, I'm new here, this is a more easily reproducible example than the original one below it. In this example I'm trying to right-click, arrow down to "save as" and hit enter. Right-click works but nothing else.
library(RSelenium)
driver <- rsDriver()
remDr <- driver[["client"]]
remDr$navigate("https://www.google.com/")
webElem <- remDr$findElement("css", "html")
webElem$click(2)
webElem$sendKeysToElement(list(key = "down_arrow", key = "down_arrow", key = "enter"))
OLD EXAMPLE BELOW. Opens a browser, navigates to a form page, chooses all results from 2016, and clicks a "view document" button in the first row to open the page to the PDF. :
driver <- rsDriver()
remDr <- driver[["client"]]
remDr$navigate("https://portal.sos.state.nm.us/FinancialDisclosure/search.aspx")
webElem <- remDr$findElement(using = 'id', value = "ContentPlaceHolder1_ddlYear")
webElem$sendKeysToElement(list("2016", key = "enter"))
webElem <- remDr$findElement(using = 'id', value = "ContentPlaceHolder1_btnSearch")
webElem$clickElement()
webElem <- remDr$findElement(using = 'id', value = "ContentPlaceHolder1_gvSummary_btnShow_0")
webElem$getWindowHandles()
webElem$getCurrentWindowHandle() #Here I identify the window handle of the popup and paste it in "x" below:
webElem$switchToWindow("x")
This all works and I'm working in the correct window tab, but after the following right-click which does open the right-click menu, the last line doesn't do what I expected it to, which is highlight "save as" and hit "enter." Instead the whole screen shifts down as if one down-arrow happened, then nothing else.
webElem$click(2)
webElem$sendKeysToActiveElement(list(key = 'down_arrow', key = 'down_arrow', key = 'enter'))