Clicking on a menu item

50 views
Skip to first unread message

Attefa Salihi

unread,
Jul 27, 2016, 11:47:07 AM7/27/16
to Selenium Users
There is a link which opens a new window when you click on it (it shows the contents of a file).  However, I want to be able to right click on the link and save the file instead.  I am able to use the code below to right click on the link but can't get to clicking on 'Save link as...'.  I am using the chrome driver.

I have copied the code below for trying to click on ‘Save link as…’ but nothing seems to work (we right click on ‘click to download’ and then save the file).  I tried using MoveToElement, FindElementByXPath and SendKeys but none works.  I have attached a screen shot of the web site.

                  //right click on Download files

                var elementToRightClick = driver.FindElement(By.LinkText("Click to download"));

                Actions action = new Actions(driver);

                //this code doesn't work

                action.ContextClick(elementToRightClick).SendKeys(Keys.ArrowDown).SendKeys(Keys.ArrowDown).

                        SendKeys(Keys.ArrowDown).SendKeys(Keys.ArrowDown).Build().Perform();




Screen capture.PNG

Aniket Mane

unread,
Aug 14, 2016, 11:56:43 AM8/14/16
to seleniu...@googlegroups.com

After right clicking on your respective link,menus popping out are of chrome or related browser.
So you can click on that link by contextclick but you cant performs operations on that.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3d01737e-04f0-4407-88b0-69a28cc0e79b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages