Time for action – holding the mouse button down while moving the mouse - Selenium

In this section we will have a look at how we can press down the left mouse button and then move it around the page. If you are working on a canvas that tracks the mouse movements, you would be able to draw a picture with the actions API. Let's see this in action:

  1. Open up inteliij and create a new Selenium WebDriver project.

  2. Create a new class and a new test with the following code:

  3. Run the test. You should see the following:

What just happened?

We have just seen how easy it is to hold the mouse button down and move it all over the page and then release the buttons. This type of action is one of the most complex types of work that we will have to do since it marries together a few.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics