Search code examples
javascriptinternleadfoot

In Intern.js Leadfoot, how do I preform a CTRL Click


I'm just wondering what the preferred way to preform a ctrl + click action in leadfoot is. In java I would have used the Actions class and used keyDown, but since we have moved to a JS based framework I'm a complete fish out of water!

I've seen in the api that there is a pressKeys function but it doesn't seem to do what we need. I've thought about using jQuery to do this but I would really rather keep it in the current framework.

Any help greatly appreciated.

Peter


Solution

  • You can use pressKeys, for example:

    command.moveMouseTo(myBtn)
           .pressKeys(keys.CONTROL)
           .clickMouseButton()
           .pressKeys(keys.CONTROL)
    

    A good thing to remember about pressKeys (https://theintern.github.io/leadfoot/Command.html#pressKeys)

    keys: The text to type in the remote environment. It is possible to type keys that do not have normal character representations (modifier keys, function keys, etc.) as well as keys that have two different representations on a typical US-ASCII keyboard (numpad keys); use the values from leadfoot/keys to type these special characters. Any modifier keys that are activated by this call will persist until they are deactivated. To deactivate a modifier key, type the same modifier key a second time, or send \uE000 ('NULL') to deactivate all currently active modifier keys.