Actions

  • page
Guides.actions  

Actions are used to simulate user behavior such as clicking, typing, moving the mouse.

Commands

Actions run asynchronously, meaning they do not complete all their events immediately.
However, each action is queued so that you can write actions (and waits) linearly.

F('textarea').click().type("Hello World");
  
F('.resizer').drag("+20 +20");

Common mistake

Almost always before performing an action, you should perform a wait that makes sure the element you're operating on is ready. A common pattern is calling visible before most actions.

F(".foo").visible().click()

Without waits, tests may intermittently fail because of timing conditions. When click runs, it immediately simulates a click on the given element. Often, tests are triggering app behavior that renders elements in the page. If that element isn't present before the action runs, the test will fail.