You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement and fails to find it (native app) #683
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
changed the title [-]variable name used for element lookup instead of Page Factory annotation for IOSElement (native app)[/-][+]@iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement (native app)[/+]on Aug 1, 2017
changed the title [-]@iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement (native app)[/-][+]@iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement and fails to find it (native app)[/+]on Aug 1, 2017
I had the same issue and found the solution:
add the following capability to your driver initialization: capabilities.setCapability("automationName", "XCUITest")
if (isIOSXcuit() || isIOS()) { ////Should we have istvOS()
return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::iOSXCUITAutomation).orElse(null),
getBys(iOSXCUITFindBy.class, iOSXCUITFindBys.class, iOSXCUITFindAll.class));
}
Appium 1.17.1
Java Client 7.3.0
macOS Catlina
Apple TV Real device
Java 8 or 11 or 12
@iOSXCUITFindBy is working fine when the platformName = "tvOS" once i make following changes. It would be of great help if any of the contributors can review and implement the same.
Anyone can please help me how to use xpath with @iOSXCUITFindBy
Example:
@iOSXCUITFindBy(xpath = "//XCUIElementTypeButton[@name='Next']")
This is returning error.
Activity
[-]variable name used for element lookup instead of Page Factory annotation for IOSElement (native app)[/-][+]@iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement (native app)[/+][-]@iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement (native app)[/-][+]@iOSXCUITFindBy element lookup uses 'id' instead of 'accessibility id' for Page Factory annotations on an IOSElement and fails to find it (native app)[/+]guruprasadsr commentedon Oct 29, 2017
Hi,
I am also facing the same problem. I am on Appium: 1.7.0. Please help
Thanks
Guru
dianhua1560 commentedon Mar 23, 2018
For me the log shows "id", however, it treats the value as "accessibility id", so it still finds the right element.
akash1205 commentedon Apr 25, 2018
Any updates on this issue?
viktorgogulenko commentedon Jan 8, 2019
I have the same bug as well. I had to modify my MobileElements to be the same as accessibility id in IOS app =)
or in another case it will not work. My Appium java-client version is:
Please look into that as seems we are blocked in case if there is no ID for element (xpath only for example).
cosminstirbu commentedon Feb 2, 2019
Same issue, the variable name is used instead of the annotation parameter, using java-client 7.0.0.
tobizwetz commentedon Feb 28, 2019
I had the same issue and found the solution:
add the following capability to your driver initialization:
capabilities.setCapability("automationName", "XCUITest")Explanation here:
http://appium.io/docs/en/drivers/ios-xcuitest/index.html
czandler22 commentedon Jan 17, 2020
I had this problem to, but only on appium java client version 7.3.0.
On 7.2.0 it's work fine. I suspect it is a bug in new version.
dtopuzov commentedon Mar 13, 2020
I can confirm the same for @AndroidFindBy too.
7.2.0:
@AndroidFindBy(accessibility = "email")do the same as driver.findElement(MobileBy.AccessibilityId("email"))7.3.0:
@AndroidFindBy(accessibility = "email")do the same as driver.findElement(By.id("email"))dtopuzov commentedon Mar 14, 2020
Updates:
When use
I hit the issue/
When use
It works properly even with 7.3.0
May is happens because this check looks for
String.class:java-client/src/main/java/io/appium/java_client/pagefactory/AppiumFieldDecorator.java
Line 91 in 6cd31e2
mykola-mokhnach commentedon Mar 14, 2020
platformName must be a string according to the standard: https://w3c.github.io/webdriver/#capabilities
pavanredt commentedon Jun 30, 2020
Having the same issue with "iOSXCUITFindBy" when the platformName = "tvOS". Still going through/trying to understand the code but looks like TVOS was not handle in "buildMobileNativeBy" method of https://github.com/appium/java-client/blob/v7.1.0/src/main/java/io/appium/java_client/pagefactory/DefaultElementByBuilder.java
if (isIOSXcuit() || isIOS()) { ////Should we have istvOS()
return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::iOSXCUITAutomation).orElse(null),
getBys(iOSXCUITFindBy.class, iOSXCUITFindBys.class, iOSXCUITFindAll.class));
}
Appium 1.17.1
Java Client 7.3.0
macOS Catlina
Apple TV Real device
Java 8 or 11 or 12
pavanredt commentedon Jul 2, 2020
@iOSXCUITFindBy is working fine when the platformName = "tvOS" once i make following changes. It would be of great help if any of the contributors can review and implement the same.
Add the following in https://github.com/appium/java-client/blob/v7.1.0/src/main/java/io/appium/java_client/pagefactory/bys/builder/AppiumByBuilder.java
protected boolean isTVOS() {
return TVOS.equalsIgnoreCase(platform);
}
update line 173 in https://github.com/appium/java-client/blob/v7.1.0/src/main/java/io/appium/java_client/pagefactory/DefaultElementByBuilder.java to
if (isIOSXcuit() || isIOS() || isTVOS()) {
Thanks
STC-FaizanMamji commentedon Dec 2, 2021
Anyone can please help me how to use xpath with @iOSXCUITFindBy
Example:
@iOSXCUITFindBy(xpath = "//XCUIElementTypeButton[@name='Next']")
This is returning error.
Anyone can please help me in this?