Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Selenium Webdriver Actions are not working with context menu (right click)

dsidler:

I am trying to use Selenium Webdriver to right click on a page, and navigate the context menu. This script should open a right click menu, and navigate Up 2 options, then select with the Return key...


driver.Navigate().GoToUrl("http://www.google.com");
//Google search bar
IWebElement tb = driver.FindElement(By.Id("lst-ib"));
Actions action = new Actions(driver);
//Right Clicks outside of the search bar.
action.MoveToElement(tb, -5, -5).ContextClick().Perform();
action.SendKeys(Keys.Up).SendKeys(Keys.Up).SendKeys(Keys.Return).Perform();

The right click executes as it should (outside of the search bar), but after that, there is no evidence of the Up arrow being pressed, and nothing is selected with the Return key. The menu options should highlight as they scroll through.

I am using the latest version of ChromeDriver 2.30, and Chrome 59.0.3071.109



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Selenium Webdriver Actions are not working with context menu (right click)

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×