Selenide-Appium – Mutated Java Appium Client [Testμ 2023]
Tags: testing, opensource, javascript, appium
Published: 2023-11-22 13:32:48

In this session, our speaker, Amuthan Sakhtivel, walked us through Selenide-Appium — a game-changing open-source library built on Appium Java Client. We discovered how Selenide-Appium can significantly reduce the script development time, giving more room to focus on what truly matters. The session ended with an interactive demo on Selenide-Appium and a discussion of its integration with cloud-based platforms like LambdaTest.

## About the Speaker

Amuthan Sakhtivel is a passionate advocate for testing, Java, open source, and education. He’s not only a contributor to projects like Selenide and Selenide-Appium but also a knowledge sharer through his YouTube channel and technical blogs. Currently, he works with Clipboard Health as a Staff Software Engineer.
{% youtube C8rbEuvvg0I  %}
If you couldn’t catch all the sessions live, don’t worry! You can access the recordings at your convenience by visiting the [LambdaTest YouTube Channel](https://www.youtube.com/c/LambdaTest?sub_confirmation=1).

## Why Selenide-Appium?

Getting started with the session, Amuthan talked about why he prefers Selenide-Appium over Appium in his testing efforts. He highlighted Selenide’s advantages, such as being free, open source, and built on top of Appium. Amuthan emphasized Selenide’s concise and readable APIs, which simplify the code. Additionally, Selenide handles common problems and exceptions, ensuring stability.

![](https://cdn-images-1.medium.com/max/3200/0*VmAgyW44kvEm60Ks.png)

Further, he highlighted that Selenide simplifies handling common mobile app testing challenges, such as timeouts, Ajax calls, screenshot capture, and state element reference exceptions. These advantages collectively allow developers to focus primarily on their app’s business logic, sparing them from diving into the intricacies of low-level interactions.

![](https://cdn-images-1.medium.com/max/3200/0*7fC5V6xBUP-dpnAf.png)

Amuthan discussed how Selenide offers a higher-level testing library with built-in assertions and waiting conditions compared to Appium, allowing testers to focus on writing business logic while simplifying interactions and automating many aspects of testing.

## Selenide-Appium for Mobile App Testing

Before showing the live demo of Selenide-Appium in action, Amuthan discussed several aspects related to mobile app testing and how Selenide-Appium simplifies the process. This approach improves code quality, readability, and maintainability for mobile app developers.

**Smart Wait from Selenide-Appium:**

Amuthan emphasized the complexities of waiting for elements in Appium, including the need for explicit timeout declarations and specific conditions. He introduced Selenide’s ***should*** and ***shouldHave*** methods as powerful tools to simplify this process.

![](https://cdn-images-1.medium.com/max/3090/0*p0gGkJpSvHvMQrwF.png)

By incorporating these methods into test scripts, developers can express waiting conditions in a more human-readable format. This approach eliminates much of the boilerplate code typically required for handling element visibility and other conditions during testing. He mentioned that Selenide allows users to focus on the intent of their tests rather than the mechanics of waiting for elements.

![](https://cdn-images-1.medium.com/max/3106/0*2jhoprwaNBlsFcrV.png)

**Working with Deep Links:**

The challenge of launching deep links in mobile app testing lies in the differences between Android and iOS implementations. Amuthan elaborated on how Selenide-Appium acts as an **abstraction layer**, shielding users from these platform-specific complexities.

![](https://cdn-images-1.medium.com/max/3102/0*Lw8KQBkFxf5mQRYy.png)

With Selenide-Appium, developers can consistently launch deep links across various platforms and devices using a unified approach. This abstraction empowers testers to avoid the intricacies of different platform-specific code, enhancing test script clarity and maintainability.

![](https://cdn-images-1.medium.com/max/3096/0*0W1EreUqWuP0ZX5B.png)

**Additional Selectors:**

Amuthan addressed the length and error-proneness of using XPath expressions for element selection in Appium. He introduced Selenide’s ***byAttribute*** mechanism, which simplifies the selection of elements based on attributes.

![](https://cdn-images-1.medium.com/max/3090/0*vJ7MaZ0imBdLZK3t.png)

This alternative to crafting intricate XPath expressions results in cleaner and more reliable test code. Developers can easily adopt this approach to select elements with specific attributes, improving the maintainability of their test scripts.

**Hide Keyboard:**

Managing the keyboard during mobile app testing often requires creating platform-specific code. Amuthan highlighted how Selenide abstracts keyboard interactions, offering a platform-agnostic method for hiding the keyboard.

![](https://cdn-images-1.medium.com/max/3100/0*JrQJrLm4uNQWc9WA.png)

This abstraction streamlines test scripts and ensures consistent behavior across Android and iOS, irrespective of the underlying platform intricacies. Testers can now focus on the logic of their tests without being burdened by platform-specific keyboard handling.

**Other Native Events:**

Amuthan discussed the complexities involved in performing native events, such as tapping or double-tapping, in Appium. He demonstrated how Selenide simplifies these interactions, providing concise and readable code for actions like tapping, double-tapping, and swiping.

![](https://cdn-images-1.medium.com/max/3092/0*PFFGx_YmYWA6mAfz.png)

Selenide’s capabilities enable testers to execute these native events without delving into the intricacies of low-level code, enhancing the efficiency and readability of test scripts.

**Combined Attribute:**

Selenide introduces the ***CombinedBy*** class for defining custom attributes. Amuthan explained how this feature enables users to create custom attribute conditions tailored to different platforms.

![](https://cdn-images-1.medium.com/max/3098/0*a8TeznteFMwazsxo.png)

By handling platform-specific logic internally, Selenide streamlines element selection and reduces the need for extensive platform-specific conditional code. This approach simplifies the process of selecting elements with specific attributes, promoting code simplicity and maintainability.

![](https://cdn-images-1.medium.com/max/3100/0*a4qwfG3JS6Tz5Mtt.png)

**Dynamic Locators:**

Dynamic locators, particularly when involving index-based selections, can pose challenges in Appium. Amuthan illustrated how Selenide simplifies dynamic locator handling by allowing users to define dynamic locators using a single ***CombinedBy*** instance.

![](https://cdn-images-1.medium.com/max/3090/0*7LuXm0qVxIXSnwHc.png)

This capability reduces the complexity of managing dynamic locators and minimizes the need for conditional code in test scripts. Developers can now create more robust and maintainable tests, even when dealing with dynamically changing elements.

![](https://cdn-images-1.medium.com/max/3096/0*l1vZBktCZS1X5VXE.png)

**Scroll/Swipe to Element:**

Scrolling or swiping to locate elements in Appium can be intricate, often requiring multiple steps and error handling. Amuthan highlighted that Selenide-Appium offers built-in methods to simplify these interactions.

![](https://cdn-images-1.medium.com/max/3098/0*nQMLYPzKvISbRSLY.png)

With Selenide-Appium, testers can efficiently scroll or swipe to elements, significantly enhancing the ease of locating and interacting with elements within the app. This capability enhances the overall robustness and readability of test scripts.

![](https://cdn-images-1.medium.com/max/3100/0*XsB2NZ0chWl5ByNL.png)

**Triple Click — Custom Command:**

Amuthan discussed the flexibility of Selenide-Appium in creating custom commands to address unique testing scenarios. He showcased how users can implement custom commands by extending Selenide’s functionality.

![](https://cdn-images-1.medium.com/max/3084/0*yuAtXSGonAI-dVO1.png)

This feature allows customized interactions, such as triple-clicking, tailored to specific testing requirements. Testers can seamlessly adapt the framework to suit their unique testing needs, thereby expanding the scope and versatility of their test scripts.

## A Live Masterclass on Selenide-Appium

Amutha gave a comprehensive demo on Selenide-Appium, highlighting the advantages and capabilities of Selenide-Appium in simplifying mobile app testing and promoting efficient test automation. This is the stepwise breakdown of the demo he presented:

1.**Project Setup:** Amuthan initiated the demo by showcasing a Maven project setup with relevant dependencies. He mentioned the inclusion of dependencies for JUnit Jupiter, the chosen testing framework, and highlighted that **TestNG** could also be used. This project setup formed the foundation for the subsequent test script.

![](https://cdn-images-1.medium.com/max/3096/0*eRfdKo7nc1z0k5eW.png)

2.**Test Use Case:** The use case chosen by Amuthan for the demo involved interacting with a mobile app. The scenario was to navigate through the app’s screens, click on specific elements, scroll to find elements, perform a custom triple-click action, and validate the result. This use case demonstrated various aspects of mobile app testing.

![](https://cdn-images-1.medium.com/max/3096/0*A9nV9H-50yegCbTQ.png)

3.**Selenide-Appium’s Simplifications:** Throughout the demo, Amuthan emphasized how Selenide-Appium simplifies the mobile app testing process, making it more efficient and readable. He highlighted that Selenide-Appium abstracts many complexities, enabling testers to focus on the intent of their tests rather than dealing with low-level details.

![](https://cdn-images-1.medium.com/max/3088/0*9LuJc42-vd0_UsMb.png)

4.**Element Locators:** Amuthan showcased how Selenide-Appium simplifies element locators. He used a straightforward approach to locate elements using text-based selectors (e.g., ***by.text(“Next”)***) instead of manually crafting complex XPath expressions. This approach significantly reduced code noise and enhanced readability.

![](https://cdn-images-1.medium.com/max/3092/0*fLVcsa0tkpkKU8mk.png)

5.**Selenide’s Page Object Model:** Amuthan introduced **Selenide’s Page Object Model**, emphasizing its ease of use compared to the traditional Page Factory. He demonstrated how Selenide’s Screen object abstracts element initialization and eliminates the need for explicit Page Factory calls. This approach simplifies the organization of test code and reduces the risk of null pointer exceptions.

![](https://cdn-images-1.medium.com/max/3200/0*sV6H9177W7h9HPUr.png)

6.**Custom Command Creation:** In the demo, Amuthan showed how to create a custom command called **“triple click”** to address a unique testing scenario. While a simple **triple click** action might not be common, he explained that users could create custom commands to suit specific testing requirements. Custom commands were implemented by extending Selenide’s functionality and could be seamlessly integrated into test scripts.

![](https://cdn-images-1.medium.com/max/3200/0*0AcbnmbYBedxvoYo.png)

7.**Automated Test Script:** Amuthan systematically built the script, from setting up the test environment to defining test steps. He demonstrated how Selenide’s conditions (e.g., **should.be(visible)**) could be used to wait for and interact with elements without writing complex explicit waits or condition checks. The script followed the Page Object Model pattern, ensuring a clean code structure.

![](https://cdn-images-1.medium.com/max/3200/0*nyJ6Toa-zpOaox20.png)

8.**Running Tests on Different Platforms:** In the demo, Amuthan showed how to configure and run the same test on different platforms, such as locally and on-cloud providers like **LambdaTest**. This flexibility allows testers to execute tests on various devices and environments effortlessly.

![](https://cdn-images-1.medium.com/max/3104/0*PrhvYbQ2x23MaoPE.png)

9.**Real-Time Test Execution:** Amuthan conducted a real-time test execution, showcasing how the automated script seamlessly interacted with the mobile app. He emphasized that Selenide-Appium abstracts many low-level interactions with the app, making test execution straightforward. This abstraction enables testers to focus on the core test scenarios and business logic without getting entangled in the complexities of mobile app interaction.

![](https://cdn-images-1.medium.com/max/3200/0*nFbT-OWwRv75D0-9.png)

10.**LambdaTest Integration:** In a brief demo of LambdaTest integration, Amuthan configured platform-specific details to run tests on it. This highlighted how Selenide-Appium can easily integrate with cloud providers, offering testers the flexibility to run tests in the cloud. This integration extends the reach of testing to a wide range of devices and environments, ensuring comprehensive test coverage and compatibility.
{%twitter 1694792912805187733%}
Amuthan wrapped up this insightful yet interactive session with this demo. After the end of the session, he moved on to answer some questions from the audience.

## Time for Some Q&A

**Q. How does the mutation of the Java Appium Client in Selenide-Appium enhance the capabilities and performance of mobile test automation?**

**Amuthan:** It makes testing easy without slowing down performance. You save time writing tests, and they’re easier to read. The Java Appium client in Selenide-Appium provides shortcuts so you can focus on testing, not technical details. It doesn’t affect performance; it improves code quality.

**Q. What impact does Selenide-Appium have on the readability and structure of test scripts?**

**Amuthan:** I’ve been using Appium for a long time, and I’ve seen how it evolves rapidly, which can be challenging to keep up with. Ensuring code works across different devices with varying specifications is complex. However, in our organization, adopting Selenide-Appium has significantly improved test readability and our testing speed. Before, we could only create 1 or 2 scripts daily, but now we manage 4 to 8 scripts daily, making our testing process faster and more efficient.

**Q. Could you discuss a scenario where this combination facilitated cross-platform testing, saving time and effort?**

**Amuthan:** Yes. Selenide can automate Android and iOS, and I can personally vouch for its effectiveness. I’ve used it in my personal and office projects, which has consistently saved us a lot of time when creating tests. I highly recommend giving it a try.

**Q. Can you elaborate on some key mutations or enhancements that set Selenide-Appium apart from the traditional Appium Client?**

**Amuthan:** Sure, we can call these enhancements “mutations.” Without altering Appium itself, we’ve crafted adaptable wrappers. Launching the app is simplified using provider classes and the Webdriver provider interface. Our wrappers manage sessions and support parallel test execution, improving code clarity and readability. Plus, you can effortlessly switch back to Appium using ***AppiumDriverRunner.getDriver()*** if Selenide lacks a specific capability.

Have a question? Feel free to drop it on the [LamdaTest Community](https://community.lambdatest.com/t/discussion-on-selenide-appium-mutated-java-appium-client-by-amuthan-sakthivel-test-2023/26941?utm_source=devto&utm_medium=organic&utm_campaign=nov_22&utm_term=bw&utm_content=community).