Commands for Interaction

Go back to tutorial

Commands for Interaction

We will now be detailing about the various Commands for Interaction with illustrations. Further, these examples showcasing different type of commands are used in Java.

Commands for interaction in appium

TYPE 1 – Commands for Interaction – Mouse Commands

1. Click

The command is used to click any mouse button at the current mouse coordinates.

Example –

Actions action = new Actions(driver);

action.moveTo(element);

action.click();

action.perform();

HTTP API Specifications

Endpoint – POST /session/:session_id/click

URL Parameters –

  • session_id ID of the session to route the command to

JSON Parameters –

name type description
button number Which button, {LEFT = 0, MIDDLE = 1 , RIGHT = 2}. Defaults to the left mouse button if not specified

Response – null

2. Button Down

This command is used to click and hold the left mouse button at the current mouse coordinates. Further the next mouse-related command that should follow is buttonup.

Example –

Actions action = new Actions(driver);

action.moveTo(element);

action.clickAndHold();

action.perform();

HTTP API Specifications

Endpoint – POST /session/:session_id/buttondown

URL Parameters –

  • session_id ID of the session to route the command to

JSON Parameters –

name type description
button number Which button, {LEFT = 0, MIDDLE = 1 , RIGHT = 2}. Defaults to the left mouse button if not specified

Response – null

TYPE 2 – Commands for Interaction – Touch Commands

1. Tap

This touch interaction commands is used to single tap on the touch enabled device.

Example –

TouchActions action = new TouchActions(driver);

action.singleTap(element);

action.perform();

HTTP API Specifications

Endpoint – POST /session/:session_id/touch/click

URL Parameters –

  • session_id ID of the session to route the command to

JSON Parameters –

name type description
element number ID of the element to double tap on

2. Scroll

This command is used to scroll on the touch screen using finger based motion events.

Example –

TouchActions action = new TouchActions(driver);

action.scroll(element, 10, 100);

action.perform();

HTTP API Specifications

Endpoint – POST /session/:session_id/touch/scroll

URL Parameters –

  • session_id ID of the session to route the command to

JSON Parameters –

name type description
x number X coordinate on the screen
y number Y coordinate on the screen

Response – null

Learn and Practice with hundreds of Mobile Testing (Appium) Exam. Become Job Job Ready Now!

Boost your chances for better job opportunities. Practice and Prepare for Mobile Testing (Appium) Exam Now!

Go back to tutorial

Share this post
[social_warfare]
Commands for Element
Writing and Running Tests In Appium

Get industry recognized certification – Contact us

keyboard_arrow_up