Using Java and Selenium, I am trying to get this link:
So from what I found, first I do a
Actions action = new Actions(driver);
scrollToElement(href);
action.contextClick(href).perform()
which brings up the menu, as it should. But then I do
action.sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).build().perform();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
action.sendKeys(Keys.RETURN).build().perform();
However, that seems to do an arrow down OUTSIDE of the context menu. This is a PDF link, so instead of selecting "Save link as", it hits the down arrow OUTSIDE of the context menu, so it closes the context menu, and just left-clicks on the pdf href.
So I am wondering about somehow having it move the arrow down while still in the context box. Or is there an xpath for "Save link as..."? I can't do an inspect on it. I suppose, I could try a
//*[contains(text(), 'Save link as"')]
but not sure that will work or not? Has anyone had this situation?