1

Click here for UI automater screenshot
Not able to handle any elements on one of the screens of Android native application with Appium. I have used UIAutomator to locate the elements. For rest of the screens, the script is running fine. I am just facing the issue in the above-mentioned screen only.

In the screenshot, 'Skip For Now' button is spied. Please note that the same exception is coming while performing actions on any of the elements from the same screen.

Java client 5.0.4
Selenium Server 3.14
Appium version 1.6.1

The exception is

'Returned value cannot be converted to WebElement:{stacktrace=NoSuchElementError: An element could not be located on the page using the given search parameters.'

PS: I have also added timers and wait in the code.

Here is the different code used to locate 'Skip for Now' button: 1. driver.findElement(By.id("ewc.ewcandroid:id/lay_reservation_bottom_btnCancel")).click();

  1. driver.findElement(By.xpath("//android.widget.ImageView[@index='0']")).click();
  • Questions seeking debugging help ("**Why isn't this code working?**") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself**. Questions without **a clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example.](https://stackoverflow.com/help/mcve) – undetected Selenium Aug 27 '18 at 13:05
  • What locator are you using? Is there a "NAF" property setting for that element? – Bill Hileman Aug 27 '18 at 13:27
  • Hi @BillHileman , I am locating the element by ID. I am able to get its ID from UIAutomater. Also, 'Clickable' property is true. NAF property is set 'true' for that element. – Shiv Jirwankar Aug 27 '18 at 14:34
  • The NAF stands for Not Accessible Friendly (or some similar word) so I'd be curious to see a screenshot of the element highlighted along with its properties. That typically does not happen if a resource-id is provided. When I asked for the locator, are you using an xpath or using by.id with a mobile webdriver? If you're using xpath, you might be looking for "id" instead of "resource-id" – Bill Hileman Aug 27 '18 at 14:46
  • Hi @BillHileman , I am using By.Id and passing the "Resource ID" as its value. – Shiv Jirwankar Aug 27 '18 at 14:52
  • Please add some of your code to your original post to show how you are doing it, I need to see how the driver is declared and what locator, exactly, you are using. I also still need to see a screenshot of the UIAutomator screen because there's usually a good reason an element is flagged as NAF. – Bill Hileman Aug 27 '18 at 15:12
  • @ShivJirwankar try using **Appium Desktop Inspector** to check the element. Using Appium Desktop Inspector, you can navigate to different screens,you don't need to grab screenshot for each app screen. – Suban Dhyako Aug 28 '18 at 06:45
  • Hi @BillHileman . Thank you for showing your interest. I have added the screenshot of UIAutomator of that very screen. Please have a look at it. – Shiv Jirwankar Sep 04 '18 at 10:54
  • What jumps out at me is the NAF property is set to true. NAF stands for Not Accessible Friendly, I believe, but oddly there is a resource-id provided, so I'm not sure why it's flagged that way. Could you please show the exact java code that you are using, even if just one line, to locate that element, in the original post. I also assume since it's called "cancel" it must be the "skip" button that is highlighted? It's hard to tell from the screenshot. – Bill Hileman Sep 04 '18 at 13:28
  • Sorry, after re-reading my original comments above I see I'm being redundant in explaining NAF again – Bill Hileman Sep 04 '18 at 13:28
  • Hi @BillHileman , I have added the screenshot link in the description and also provided what all locators used to locate 'Skip For Now' button. Kindly share your thoughts. Thanks. – Shiv Jirwankar Sep 06 '18 at 10:41
  • Your code looks correct to me, but now I have to wonder why just this screen? I take it that you are able to locate elements on other screens leading-up to this screen. It would have to be some kind of timing issue, I would think, but you've stated that you've placed "timers" and waits. What is the implicit wait setting, where and how, and are you also using explicit waits? Have you tried just adding a sleep statement as at least a temporary attempt? – Bill Hileman Sep 06 '18 at 13:22
  • @BillHileman Yes, I have added the implicit wait and along with that have also added the sleep statement after each action. Still the same issue persist. Not sure where actually the problem is. – Shiv Jirwankar Sep 06 '18 at 13:44
  • Read here: https://discuss.appium.io/t/how-to-handle-the-situation-when-naf-not-accessibility-friendly-is-true/536 You might be able to access the button by doing an xpath to the parent element, then referencing the imageview from that element. I don't know the xpath to the parent or I'd show you my suggested xpath. – Bill Hileman Sep 06 '18 at 13:52

0 Answers0