Skip to content

@FindBy locators is not working in the webview context when we have @AndroidFindBy and @IOSFindBy #1122

@fabytta

Description

@fabytta

@findby does not work any more

when I switch to the webview context, the appium client should use the locator defined in @findby and it should use the @AndroidFindBy and @iOSFindBy only when I'm in native contexts on Android and iOS platforms, but since we updated the appium-java client to 6.1.0, even in Webview context I get only @AndroidFindBy and @iosFindBy used

Environment

  • Appium version (or git revision) 6.1.0
  • Last Appium version that did not exhibit the issue (if applicable): 4.1.2
  • Desktop OS/version used to run Appium: do not know : using a cloud service
  • Node.js version (unless using Appium.app|exe): do not know : using a cloud service
  • Npm or Yarn package manager: do not know : using a cloud service
  • Mobile platform/version under test : all paltforms / OS versions
  • Real device or emulator/simulator: real device
  • Appium CLI or Appium.app|exe: do not know : using a cloud service

Code To Reproduce Issue [ Good To Have ]

define your elements :
@findby(xpath = "//input[@id='personalInfo-firstName' or @id='addressInfo-firstName']")
@AndroidFindBy(xpath = "//[@resource-id='personalInfo-firstName']")
@iOSFindBy(xpath = "//
[@Label='personalInfo-firstName']")
private MobileElement firstName;

in the test switch to webview context -> switch done sucessfully (and it's a webview page wrapped in the app)
try to find the element and send key -> in the report I find that the driver try to find the element by the locator declared in the @AndroidFindBy (or @iOSFindBy when I'm on iOS)

PS when I remove the two annotations @AndroidFindBy and @iOSFindBy, it looks then for the xpath declared in the @findby

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions