Using WebDriver Actions class to interact with TeamMentor contextual menu

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 ActionsTo 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);

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



About Michael Hidalgo

Michael is a Software Developer Engineer based on San José, Costa Rica. He leads the OWASP Chapter from Costa Rica. You can take a look at my blog at
This entry was posted in JQuery, UnitTests, WebDriver and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s