Xpath issue in marshmallow

I m trying to click that element

I found this, can you get the idea and play around for any luck?

Its not able to find the element using xpath. If its found only it is possible to click or send keys to that element. Please suggest me how to find that element

Could you possibly share us the screen from UIAutomator. People will have a chance to give you the correct suggestion.

Ok, from my point of view I would like to suggest (other people can have some better approach one)


  1. Build method: public boolean isMarshmallow to return the boolean to check whether the current device is v6.0
    ref: http://stackoverflow.com/questions/22092118/get-device-information-such-as-product-model-from-adb-command

  2. In POF (page object factory) where you keep element attribution

    For element_X
    //return the xpath with viewGroup
    else {
    //Return the normal one for other Android Version

  3. In test script, when you call the POF, we will have the correct one based on the Mobile is running

@Durga_M : As ScrollView is common irrespective of Android version You can store the items in list and iterate through each.

List<WebElement> items = (List<WebElement>) driver.findElements(By.xpath("//android.view.ScrollView/*"));
    for(WebElement we : items) {
        // write your test logic here

I understand there are 2 scrollViews, so the list will find the first one. I would suggest to check the attributes of scrollView and then re-write xpath accordingly.

1 Like

Thanks… i l try this and update

At the step 01, before applying that approach (to cover any Android v6.0), you can try an simpler solution.
Just need to check the UDID (you already have the Android v6.0’s UDID) and return the expected xpath. once it works, you can try the last approach that I mentioned.

Besides, don’t stop finding out a better one. Discuss around to get some good idea from those who faced that kind of problem.

Hopefully it helps you.

Hi Aleksei,
How you are adding Id’s into code. Basically our application is android Hybird application, in my case also there is no Id’s present for selecting dropdown values. So could you please provide me solution to adding Id’s for List view elements.

we are with native. we can add any id to any element. never did with web app.

I tried with the second approach and it is working.Thanks

wow, happy when hearing that.

About: Build method: public boolean isMarshmallow to return the boolean to check whether the current device is v6.0.

When you have time, give a try. Because you can change another device for testing. Control by using UDID is not flexible.

I’m not using UUID approach; I have used the approach of checking the capability of the device whether it is marshmallow or not using the below code:
This is working fine for all the versions

1 Like


I am starting the appium server using the following code snippet and it works fine:

public void appstart() {
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/Applications/Appium.app/Contents/Resources/node/bin/node"))
.withAppiumJS(new File("/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js"))
.withLogFile(new File("/Users/Desktop/logs.txt")));
try {
//setting the capabilities
} catch (Exception e) {

Now I need to go on with parallel execution. If I use grid I need to create different nodeconfig.json files which includes the appium instance details. If I need to run my test in three device is it necessary to create three different nodeconfig.json files? Is it possible to use the same code snippet to start the appium for parallel execution, if so how? Please help me on this

How to start with the parallel execution in appium?

I have never used grid although I’m still running my test in multiple Android devices in Parallel (I couldn’t for iOS as it’s a limitation).

With no-grid option, I can share you.

ok … its ok with no grid option also

Without Grid how are you able to work on multiple devices

@Durga_M, ok, I will share you steps to achieve that. (tomorrow, it’s 19:05 now, I’m going home)

@pavan_appium, I created the Mobile Framework for my current company. I’m not using grid for running test in parallel.

ok … no probs