I was trying to add a test to verify that TeamMentor contextual menu, was displayed using mouse right-click, so you should be able to see a menu like this one :
Fortunately, WebDriver provide a class to interact with some user actions like double-click for instance. This class is named Actions. To give you an idea on what methods this class provides, I’ve auto generate the following class diagram, which gives the big picture of the Actions class definition ( and all the user actions it’s able to handle).
Therefore if we need to perform the right-click action, you will need to use the following syntax:
//Defining Actions var action = new Actions(driver); action.ContextClick(jsTree).Build().Perform();
Now we are able to display (via browser automation) this context menu, therefore our purpose here is to verify that two options are displayed when the context menu was displayed. Using jQuery selectors, we can now access the context menu and perform some asserts on that:
If you want to see the unit test for that, you can see Contextual_Menu_Is_Displayed_On_Right_Click