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.

Pagefactory AndroidFindBy not taking effect on appium java 7.3.0

See original GitHub issue

Page Factory, Android Find By locator helper not initializing locators correctly in java client 7.3.0, works fine on 7.2.0.

Environment

Appium Java Client : 7.3.0 JDK : Open JDK 13 Node: v10.17.0 Run time: Node Server (Haven’t tested on appium desktop) Windows 7 Android 7 Emulator

Code To Reproduce Issue [ Good To Have ]

public class HomeScreen {

  public HomeScreen(AppiumDriver appiumDriver) {
    PageFactory.initElements(new AppiumFieldDecorator(appiumDriver), this);
  }

  @AndroidFindBy(id = "com.mycompany:id/searchKeyword")
  public WebElement searchCase;
  
}

JDK: Open JDK 13

Appium Java Client : 7.2.0 - Debug View of ‘searchCase’ element after page factory init

result = {AndroidElement$$EnhancerByCGLIB$$b598166c@3735} "Located by By.chained({By.id: com.mycompany:id/searchKeyword})"
 CGLIB$BOUND = true
 CGLIB$CALLBACK_0 = {ElementInterceptor@3786} 
  locator = {AppiumElementLocator@3794} "Located by By.chained({By.id: com.mycompany:id/searchKeyword})"
   shouldCache = false
   by = {ContentMappedBy@3797} "By.chained({By.id: com.mycompany:id/searchKeyword})"
    map = {HashMap@3802}  size = 2
     {ContentType@3803} "NATIVE_MOBILE_SPECIFIC" -> {ByChained@3809} "By.chained({By.id: com.mycompany:id/searchKeyword})"
     {ContentType@3810} "HTML_OR_DEFAULT" -> {ByIdOrName@3811} "by id or name "searchCase""
    currentContent = {ContentType@3803} "NATIVE_MOBILE_SPECIFIC"
     name = "NATIVE_MOBILE_SPECIFIC"
     ordinal = 1

Appium Java Client: 7.3.0 - Debug View of ‘searchCase’ element after page factory init

result = {AndroidElement$$EnhancerByCGLIB$$b598166c@3703} "Located by By.id: searchCase"
 CGLIB$BOUND = true
 CGLIB$CALLBACK_0 = {ElementInterceptor@3755} 
  locator = {AppiumElementLocator@3763} "Located by By.id: searchCase"
   shouldCache = false
   by = {ContentMappedBy@3766} "By.id: searchCase"
    map = {HashMap@3771}  size = 2
     {ContentType@3778} "HTML_OR_DEFAULT" -> {ByIdOrName@3779} "by id or name "searchCase""
     {ContentType@3772} "NATIVE_MOBILE_SPECIFIC" -> {By$ById@3780} "By.id: searchCase"
    currentContent = {ContentType@3772} "NATIVE_MOBILE_SPECIFIC"
     name = "NATIVE_MOBILE_SPECIFIC"
     ordinal = 1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

2reactions
ervukscommented, Jan 15, 2020

Just run into the same issue. Made rollback to 7.2.0 Instead of taking elements provided ID, it takes name of MobileElement object as ID.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Page factory not working in android - Issues/Bugs
appium - 1.2.2. java-client - 1.7.0. android - 4.4.2. OS - Windows 7. Following is code. public class Napp. {. @AndroidFindBy(name = “Data...
Read more >
java.lang.ExceptionInInitializerError at io.appium.java_client ...
I have recently started doing automation. So If I use PageFactory.initElements(driver, this); and try to find elements by using annotation as @ ...
Read more >
Index (java-client API) - Javadoc.io
Activates the given app if it installed, but not running or if it is running in the ... AndroidFindBy - Annotation Type in...
Read more >
Java Client - io.appium - Maven Repository
Java client for Appium Mobile Webdriver. License, Apache 2.0. Tags, client. Ranking, #1608 in MvnRepository (See Top Artifacts). Used By, 260 artifacts ...
Read more >
appium / java-client Download - JitPack
com.google.code.gson:gson was updated to 2.9.1. 8.1.1. [BUG FIX]. Perform safe typecast while getting the platform name.
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