Issue
We have a Chrome extension which adds telephony functionality to the browser and I am trying to write a test scenario where the user right clicks on a telephone number and then clicks the Dial option from the context menu.
I have seen many workarounds for this and used many myself in the past, but in this scenario I really need to click the context menu item. If I try doing a click offset the item under the context menu is clicked instead.
Can a context menu item selection be done through the webdriver?
Solution
You can build an action with the contextClick()
:
Actions actions = new Actions(webDriver);
actions.contextClick().sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).perform();
It is in Java
but you can easly implement something like this in C#.
It will select something from the context menu, you just need to add some more ARROW_DOWN
's
Answered By - Moro
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.