Top Appium Interview Questions (2024)
What is Appium?
What is the difference between Appium and selenium?
What is Appium Server?
What is Appium client libraries?
What is the use of Json Wire Protocol in Appium?
What is Appium Android Driver in Appium?
Explain Appium architecture and how it works?
How to use touch actions in Appium?
How do I move elements in Appium?
What is UiAutomator2 in Appium?
What is Drag And Drop Action?
How to do Drag And Drop action using Appium?
Q: What is Appium?
Ans:
Appium is the most widely used open-source framework for testing mobile apps. It enables qa professionals to automate tests for widely used mobile platforms such as Android, iOS, and Windows. Appium supports native, mobile web, and hybrid applications using the mobile JSON wire protocol using Selenium JSON wire protocol extension.
Q: What is the difference between Appium and selenium?
Ans:
Appium is used for automated testing for mobile applications such as mobile application versions, mobile browser application versions, and Hybrid. Whereas Selenium is used for web application test automation and does not support system or mobile applications.
Q: What is Appium Server?
Ans:
The Appium Server is the important component of the Appium architecture. It is written in Node.js and runs locally or in the cloud. By using JSON Wire Protocol, Appium Server gets the requests from Appium client libraries and calls the mobile driver to connect to the respective native testing automation frameworks to perform client operations on the devices. The output of the tests are subsequently obtained and sent to the clients. The Appium Server can generate many sessions to execute tests on various devices at the same time.
Take a look at our suggested post :
Q: What is Appium client libraries?
Ans:
Appium client libraries are wrappers for typical Selenium client libraries. Additionally, it provides all of the standard Selenium commands as defined by the JSON Wire protocol, as well as additional commands for controlling mobile devices like Multi-touch gestures and screen orientation.
Q: What is the use of Json Wire Protocol in Appium?
Ans:
The JSON Wire Protocol is the mechanism used to interact between the Appium client and server. WebDriver developers created the JSON wire protocol (JSONWP) as a transport mechanism. Appium implements the Mobile JSONWP, a Selenium JSONWP extension, which manages various mobile device activities such as installing/uninstalling apps during the session.
Q: What is Appium Android Driver in Appium?
Ans:
Appium Android Driver is a solution for automating testing on Android devices. Appium Android Driver streamlines the testing of native, hybrid, and mobile web apps on simulators, emulators, and actual devices. The Appium Android Driver is a component of the Appium mobile test automation tool.
Q: Explain Appium architecture and how it works?
Ans:
At its core, Appium is a nodejs-based HTTP server that provides a REST API. The client interacts with the Appium server over REST APIs, which are handled by the Mobile JSON Wire Protocol.
- The formation of the session is the initial stage in this communication flow. The session is started by the client delivering a request to the server with session-related information in key-value pairs known as Desired Capabilities.
- Based on Desired Capabilities, Appium can distinguish between iOS and Android platforms and create a session on a target device/simulator/emulator.
- A session initiation is essentially a client POST /session request. Appium returns a session id in response to this request.
- Once the session has been created, the client and Appium server communicate using the session id as a reference.
Appium is a Client-server architecture. Below are the some important Appium Architecture components:
- Appium Server
- Appium Client Libraries
- JSON Wire Protocol
- Appium Driver
Q: How to use touch actions in Appium?
Ans:
It clicks/taps on a specific location. We can use press()
and release()
.
Tap on particular location
//TouchActions class used to support gestures.
TouchAction touchAction = new TouchAction(driver);
touchAction.tap(tapOptions()
.withElement(element(androidElement)))
.perform()
Tap on x, y coordinates
TouchAction touchAction = new TouchAction(driver);
touchAction.tap(PointOption.point(1280, 1012))
.perform();
Q: How do I move elements in Appium?
Ans:
Actions action = new Actions(driver);
action.moveTo(element, 15, 15);
action.perform();
Q: What is UiAutomator2 in Appium?
Ans:
UIAutomator 2 is an automation framework for building and running UI tests that is based on Android devices. Appium executes commands on real devices and emulators using Google's UIAutomator. UIAutomator is Google's test framework for native app UI automation.
Q: What is Drag And Drop Action?
Ans:
Drag and Drop are two actions that are performed concurrently to move an element from one particular or identified location to another. It also changes its location with x and y co-ordinates.
Q: How to do Drag And Drop action using Appium?
Ans:
Touch Action Class includes a method for longpressing the element to be dragged and moved to its destination location based on the x and y co-ordinates.
AndroidElement empObj =driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().text(\"EMPLOYEE\")"));
empObj.click();
AndroidElement dragObjs = driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\".......\")"));
AndroidElement dropObjs = driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\".........\")"));
int xcordinate_dragObjs = dragObjs.getLocation().x + (dragObjs.getSize().width/2);
int ycordinate_dragObjs = dragObjs.getLocation().y + (dragObjs.getSize().height/2);
int xcordinate_dropObjs = dropObjs.getLocation().x + (dropObjs.getSize().width/2);
int ycordinate_dropObjs = dropObjs.getLocation().y + (dropObjs.getSize().height/2);
TouchAction touchAction = new TouchAction(driver);
touchAction.longPress(PointOption.point(xcordinate_dragObjs, ycordinate_dragObjs))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(xcordinate_dropObjs, ycordinate_dropObjs))
.release()
.perform();