Showing posts with label Automation. Show all posts
Showing posts with label Automation. Show all posts

Wednesday 11 August 2021

Introduction to Appium Desktop Inspector| Get to know about various options like Select elements, swipe by coordinates, record script, find elements etc

In this video, we are going to see what is Appium Inspector and how we can use that to locate elements:

Appium Desktop offers an Inspector that you can use to look up or locate elements of an application. It also lets you perform basic actions on these elements. To write mobile automation scripts with Appium, we need to, first, run Appium Server and also a mechanism to identify the controls/elements of the mobile app which we want to automate. Considering Appium with global packages is already installed, one of the ways to launch the Appium server is via Appium Desktop. 1. Launch Appium desktop client on Mac or Windows 2. Start appium server 3. Create a new connection 4. Create desired capabilities or open from saved capabilities 5. Start the session 6. Identify elements 7. Get to know about various options like Select elements, swipe by coordinates, record script, find elements, etc

Watch the below video to understand more:-

Tuesday 9 March 2021

How to kill Appium server if device is not connected | How to find connected Android device

Subscribe to my youtube channel for more videos here:

Problem:

If the Android device was not connected during Appium Automation, it was starting the Appium server but was not able to quit it.
So, once running the script again after connecting the device , we will get error

Could not start Appium server. It's showing [Error Starting appium server: listen EADDRINUSE 0.0.0.0:4723]

Below is the script which I created to handle the situation and check if the device is already connected.
If it is not connected just Quit the Appium Server.

Solution:

if (loadPropertyFileAndroid.startsWith("Android_")) {

try {
Process process = Runtime.getRuntime().exec("adb devices");
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = null;

Pattern pattern = Pattern.compile("^([a-zA-Z0-9\\-]+)(\\s+)(device)");
Matcher matcher;

while ((line = in.readLine()) != null) {
if (line.matches(pattern.pattern())) {
matcher = pattern.matcher(line);
if (matcher.find()) {
System.out.println("android device connected");

AppiumServer.start();
CommonUtils.loadAndriodConfProp(loadPropertyFileAndroid);
log.info(loadPropertyFileAndroid + " properties file loaded !!!");
CommonUtils.setAndroidCapabilities();
driver = CommonUtils.getAndroidDriver();
String connectedDeviceName = driver.getSessionDetail("deviceName").toString();
System.out.print("Saif "+connectedDeviceName);

log.info("Appium server started");
}else{
AppiumServer.stop();

log.info("Appium server not started");
}

}
}
} catch (IOException e) {
e.printStackTrace();
}
Read about automation coding standards here: Avoid Mobile Automation Coding Pitfalls : Automation coding standards

Thursday 17 September 2020

10 tips to avoid Mobile Automation Coding Pitfalls : Automation coding standards

Beautifully written code is like Gold, it's value never depreciates.

Having taken/given multiple interviews on Mobile Automation and created multiple POC for different clients myself I would like to suggest common pitfalls that a naive can avoid while designing a POC for Mobile Automation Framework. Consistency across the code helps in readability and helps in maintaining the code which can be reusable at other places






  • Have a good code structure in terms of package/class hierarchy.
  • Use proper naming conventions at class and function level.
  • Not to use parameterization as all data will get hardcoded
  • To format the code, indentations make it beautiful.
  • To have abstraction at the test case level so all element calls are not made directly
  • To implement asserts wherever possible.
  • To avoid the usage of absolute paths to find web elements.
  • To make the code executable with no library errors.
  • Add Comments wherever possible.
  • Avoid redundancy of the code. Try to create a reusable method and functions
Lastly, Learn and self improvise, you never know what you were thinking is the right way to do is actually not the best solution as learning is never-ending.

Interview Experience with AMAZON for the role of Quality Assurance Tester

This role was for Digital/ IoT/Mobile Application based testing :)  Amazon is a dream company and everyone wants to work for that company a...

Popular Posts