Module org.testfx

Interface KeyboardRobot

    • Method Summary

      Modifier and Type Method Description
      Set<javafx.scene.input.KeyCode> getPressedKeys()
      Gets the keys that have been pressed and not yet released.
      void press​(javafx.scene.input.KeyCode... keys)
      Presses the given keys, until explicitly released via release(KeyCode...).
      void pressNoWait​(javafx.scene.input.KeyCode... keys)
      Presses the given keys, until explicitly released via release(KeyCode...).
      void release​(javafx.scene.input.KeyCode... keys)
      Releases the given keys.
      void releaseNoWait​(javafx.scene.input.KeyCode... keys)
      Releases the given keys.
    • Method Detail

      • getPressedKeys

        Set<javafx.scene.input.KeyCode> getPressedKeys()
        Gets the keys that have been pressed and not yet released.
        Returns:
        an (unmodifiable) containing the keys that have been pressed (but not yet) released.
      • release

        void release​(javafx.scene.input.KeyCode... keys)
        Releases the given keys. Once released, WaitForAsyncUtils.waitForFxEvents() is called.

        Note: passing in an empty KeyCode[] will release all pressed keys.

        Parameters:
        keys - the key codes to release
      • releaseNoWait

        void releaseNoWait​(javafx.scene.input.KeyCode... keys)
        Releases the given keys. WaitForAsyncUtils.waitForFxEvents() is not called.

        Note: passing in an empty KeyCode[] will release all pressed keys.

        Parameters:
        keys - the key codes to release without waiting afterwards