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
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
https://gist.github.com/squeemish/c6d64fa082f5d3c1a7775bae2303d030
https://gist.github.com/squeemish/eac632e9b22836a436f500c460306914
Hi,
I am also facing the same problem. I am on Appium: 1.7.0. Please help
Thanks
Guru
For me the log shows "id", however, it treats the value as "accessibility id", so it still finds the right element.
Any updates on this issue?
I have the same bug as well. I had to modify my MobileElements to be the same as accessibility id in IOS app =)
@AndroidFindBy(id = "com.ghm.free2move.wdc.integration:id/burgerIcon")
@iOSXCUITFindBy(id = "icMenu")
public MobileElement icMenu;
public MobileElement getMainMenuItem() {
return icMenu;
}
or in another case it will not work. My Appium java-client version is:
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
Please look into that as seems we are blocked in case if there is no ID for element (xpath only for example).
Same issue, the variable name is used instead of the annotation parameter, using java-client 7.0.0.
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
@tobizwetz even capabilities.setCapability("automationName", "XCUITest") is not working.. any other work arounds>
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.
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"))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
platformName must be a string according to the standard: https://w3c.github.io/webdriver/#capabilities
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
@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.
1) 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);
}**_
2) 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
Most helpful comment
Updates:
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