The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Analytics

External Resources

More Info


Page tree
Skip to end of metadata
Go to start of metadata

Performing Actions on the Application Elements

Once you've identified the mobile elements you want your test to interact with, the next step is to interact with them. You perform an action on a mobile element by invoking an interaction method on an instance of the WebElement interface.

The WebElement interface declares basic interaction methods including:

  • The sendKeys method, to enter text
  • The clear method, to clear entered text
  • The submit method, to submit a form 

Example

This example first invokes the sendKeys method to enter text in the username and password elements, and then invokes the submit method to submit the login form. 

Enter a username and a password
emailInput.sendKeys("SauceIsAwesome@email.com");

Submit the form

The submit method can be invoked either on any text input element on a form, or on the form element itself.

Submit Text Element
emailInput.submit();
  • No labels