Not able to identify the XPATH for the elements: Checkbox/RadioButton as those are hidden from Appium Inspector

Not able to identify the XPATH for the elements: Checkbox/RadioButton as those are hidden from Appium Inspector

We are automating the iPad hybrid application, but not able to identify the XPATH for the elements: Checkbox/RadioButton as those are hidden from Appium Inspector. And without XPATH fo those elements, we can’t able to perform the operations on those elements: Checkbox/Radiobuttons.
Please help me on this.

Environment

  • Appium version (or git revision) that exhibits the issue: Appium version is 1.4.13
  • Last Appium version that did not exhibit the issue (if applicable): We tried with latest version # 1.5.3 also. But the issue still persist.
  • Desktop OS/version used to run Appium: MAC 10.11.5
  • Node.js version (unless using Appium.app|exe):
  • Mobile platform/version under test: iPad 9.1(13B143)
  • Real device or emulator/simulator: Real Device
  • Appium CLI or Appium.app|exe:

Could you please share your appium inspector screenshot?
hidden as in not present on screen at the moment?

Hi Suman,

Thanks for your response.

Yes… all Checkboxes are not present in the appium inspector screen. Please find the attached screenshots for the same.

Please let us know if you want any further details on this.

Thanks,
Ramesh

We are facing same issue for all Checkboxes / Radiobuttons in all the screens in our application.

If you click on text "Medical Affairs’ it will select the checkbox. As it has label, so I assume accessibility ID is defined for this element. You can use -

driver.findElementByAccessibilityId("Medical Affairs").click();

After you click, check for value attribute.

If the above doesn’t work, then you can find the text x,y location at run time (it will vary depending on device screen size, so I won’t recommend to hard-core any value). Keep the “y” point as same and tap on (x-5) point location.

Check box / Radio button is not selecting when we click on the corresponding label in this page. But this trick is working only for some radio buttons in some of the pages.

Currently we are using Precision click using X,Y co-ordinates to select the check box in this page. As you mentioned using Precision click is not recommended, because the co-ordinates may vary depends on the device.

Hence I am trying to get the XPATH of the UIAButtons to perform the operation in all the pages.

  1. May I know why these UIAButtons particularly Checkbox/Radio Buttons are not populating from Appium inspector?
  2. Is the problem with Appium inspector or do we need to update the source code to populate those elements from Appium Inspector?
  3. Is there any other tool to get the XPATH of the UIAElements?

I think you might need to add them to app code because I have seen checkbox element ID/name before. You can use the below code to find element x,y position at run time so that it will work irrespective of device screen size.

Point p;
p = driver.findElementByAccessibilityId("Medical Affairs").getLocation();
p.getX();
p.getY();

If you use x-code instruments and record using it, what do you see? You can use instruments script in appium test then.

Hi Suman,

ID/Name for the checkbox element is not populating from Appium Inspector. You can find the same in the screenshots which I posted earlier.

Using Precision click using X,Y co-ordinates is an alternate solution and very difficult to maintain for all checkboxes/radio buttons for entire application also for all the devices as well.

Here my first concern is why all Checkboxes / Radio buttons are are not populating from Appium Inspector and how to populate those elements from appium inspector. Once we populate those elements from Appium Inspector, we can directly use XPATH to perform the operations on those elements.

So, please let us know your valuable feedback to solve this issue.

Hi Ramesh,

When I said I have seen before, I meant in my previous projects. Apologies for miscommunication. It’s really difficult to tell just by looking at screenshot why it’s not populating. You can check for element > hidden = YES

Else, like I said before what do you see when you use x-code instruments? To launch instruments go to : X-code > Developer Tools > Instruments

@ramesh_sriram Check out this post.

It says this problem occurs only when developer wraps image inside other custom view ( example in TableCell ).