Client/Server Architecture: Appium's core is a network server that exposes a publicly available REST API. It receives connections from clients, listens for commands, executes those commands on mobile devices, and presents the results of command execution as HTTP responses. The client/server architecture offers flexibility, allowing testers to write API test code with an HTTP client in any programming language. However, using the Appium client library makes the process more convenient. The server can be hosted on different machines for test execution, and cloud services like Sauce Labs and Lambda Test can be used to receive and analyze the test results.
Session: Automation is always performed within the context of a session. The client initiates a session with the server using a specific library. Ultimately, the session is ended by sending a POST /session request to the server, which includes a JSON object called desired capabilities. The server starts an automation session and returns a session ID, which can be used to send other commands.
Desired Capabilities: Desired capabilities are a collection of key-value pairs (e.g., map, hash) sent to the Appium server, informing it about the desired configuration for the automation test session. They provide a way to modify the server's behavior during automation. For example, setting the platformName to "ios" informs the Appium server that an iOS session is needed, rather than an Android or Windows session. Similarly, setting safariAllowPopups to true ensures that JavaScript can open new windows during Safari session automation. The Capabilities documentation provides information on the parameters supported by Appium.
Appium Server: Appium Server is written in Node.js and can be built and installed from source code or installed directly via npm: $ npm install -g appium $ appium For beta versions of Appium, use npm install -g appium@beta. These versions are intended for developers and may contain modifications that could cause issues. To install a new version, uninstall appium@beta first using npm uninstall -g appium@beta.
Appium Client: There are several client libraries supporting the Appium extension of the WebDriver protocol, including Java, Ruby, Python, PHP, JavaScript, and C#. When using Appium, if you prefer to use these client libraries instead of standard WebDriver client libraries, refer to the documentation for the respective client library.
Appium Desktop: Appium Server also provides a GUI mode called Appium Desktop, which can be downloaded for various platforms. It bundles all the necessary software required for executing Appium Server and can assist in inspecting the hierarchy of an app. This can be helpful when writing tests.
Appium Inspector is a graphical tool provided by Appium for viewing and editing Appium test scripts. It allows easy exploration of the element hierarchy of an application and helps locate elements for testing purposes.
How to use Appium Inspector:
Start the Appium Server (Appium Server acts as a web interface service implemented in Node.js).
Open Appium Inspector and select the connected device or emulator.
Click the "Start Session" button.
Wait for the application to launch.
Use Appium Inspector to view the element hierarchy of the application and utilize the "Inspect" tool to locate elements.
Edit the test script using the located elements for testing purposes.
By following these steps and utilizing the capabilities of Appium and Appium Inspector, testers can efficiently automate their testing processes for native, web, and hybrid applications on iOS and Android platforms. With its client/server architecture and support for various programming languages, Appium offers flexibility and code reusability, making it a powerful open-source tool for automation testing.
However, it's important to note that learning and utilizing tools like Appium and Appium Inspector can be time-consuming and may require a significant investment in terms of learning curve and resources. If you are looking for a more efficient and faster way to automate your tests, you might want to consider exploring other automation tools like WeTest Automation. With it, you can easily create, execute, and manage test cases using a visual drag-and-drop interface.