Transcripted Summary

In this section, we'll take a look at user actions that are mouse interactions.

# .mouseButtonClick()

Let's take a look at .mouseButtonClick().

The documentation reads "Click on the current mouse coordinate, which is set by .moveTo(). So for example, let's say we right-click. If we right-click inside of our exterior, this is what comes up.

Let's try and simulate that with our automation. We'll write another test and we'll call it "Should perform right click." We're already on this page, so we can just go ahead and perform our action - we want to use .mouseButtonClick() - and we said we want to do a right-click. Let's add a pause and see what happens.

We'll run the file with:

./node_modules/.bin/nightwatch -t ./tests/user.actions.prompts.js

module.exports = {
    "Should perform key strokes": (client) => {
        .setValue('#et_pb_contact_message_0', 'testing key strokes')

     "Should perform right click" : (client) => {

Ok great, we can see that happened.

We also have:

  • .doubleClick()
  • .mouseButtonDown()
  • .mouseButtonUp()
  • .moveTo()



The quiz for this chapter can be found in section 4.4

© 2024 Applitools. All rights reserved. Terms and Conditions Privacy Policy GDPR