question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement and fails to find it (native app)

See original GitHub issue

Description

The variable name assigned to an IOSElement in Page Factory annotation is used to lookup the element instead of the actual annotation locator provided.

Logs show [HTTP] --> POST /wd/hub/session/3ade3d73-6606-484d-a752-6decdab285d3/element {"using":"id","value":"subtitle"} as opposed to [HTTP] --> POST /wd/hub/session/3ade3d73-6606-484d-a752-6decdab285d3/element {"using":"accessibility id","value":"activationLink"} when @iOSFindBy is used

Environment

  • java client build version or git revision if you use some shapshot: 5.0.0 BETA9
  • Appium server version or git revision if you use some shapshot: 1.6.5/Latest Desktop
  • Desktop OS/version used to run Appium if necessary: macOS10.12.6
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: Appium.app 1.1.1
  • Mobile platform/version under test: iOS 10.3
  • Real device or emulator/simulator: real device

Details

ActivationLinkPage: https://gist.github.com/squeemish/251504367c13caa16ef04336c75cfb4c Driver/Appium creation: https://gist.github.com/squeemish/7c77faaa839b5d7ffcb82f9d1515d05b POM with system properties: https://gist.github.com/squeemish/fd8f80dfd1e5730d471f9179a4183cf0

Ecxeption stacktraces

https://gist.github.com/squeemish/c6d64fa082f5d3c1a7775bae2303d030

Link to Appium logs

https://gist.github.com/squeemish/eac632e9b22836a436f500c460306914

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
dtopuzovcommented, Mar 14, 2020

Updates:

When use

capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, org.openqa.selenium.Platform.ANDROID);

I hit the issue/

When use

capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, org.openqa.selenium.Platform.ANDROID.toString());

It works properly even with 7.3.0

May is happens because this check looks for String.class: https://github.com/appium/java-client/blob/6cd31e2b2eb979bea389918ac42f5b7ed6c40b60/src/main/java/io/appium/java_client/pagefactory/AppiumFieldDecorator.java#L91

2reactions
cosminstirbucommented, Feb 2, 2019

Same issue, the variable name is used instead of the annotation parameter, using java-client 7.0.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOSXCUITFindBy element lookup uses 'id' instead of ...
iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement and fails to find it ...
Read more >
13. Implementing Page Factory in Appium based Framework
Here, we are instructing Appium to use @AndroidFindBy to find an element using the strategy “id” and look for the text “username” in...
Read more >
iOSFindBy is displayed as deprecated, what can I use instead ...
After search in internet I find out that this can happens by using the page factory and locating elements by @iOSFindBy, After trying...
Read more >
How to Find Elements in iOS (Not) By XPath - HeadSpin
This blog gives information on the different Appium locator strategies that you can use to find elements. Read on to know more.
Read more >
Page Object Model (POM) With Page Factory | Selenium Tutorial
#1) You can locate the search field using Pagefactory as shown below. The annotation @FindBy is used in Pagefactory to identify an element...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found