Unexpected Selector Translation with @AndroidFindBy and AppiumFieldDecorator
Les mainteneurs répondent en général sous 5 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 42/100
Piste de recherche
Commencez par suivre AppiumFieldDecorator dans PageFactory.initElements lorsqu’il traite @AndroidFindBy(accessibility = "open menu") avec EventFiringWebDriver. Comparez ce chemin avec la recherche fonctionnelle AppiumBy.accessibilityId("open menu") et avec le journal d’erreurs associé. Le travail est terminé lorsque le chemin de l’annotation utilise une recherche accessibility prise en charge et que la reproduction fournie réussit sans l’erreur de sélecteur CSS non pris en charge.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
I've encountered an unexpected behavior when using @AndroidFindBy annotation in conjunction with PageFactory.initElements(new AppiumFieldDecorator(eventDriver, Duration.ofSeconds(30)), this);.
Environment
- Java client build version or git revision if you use some snapshot: 9.0.0.
- Appium server version or git revision if you use some snapshot: 2.1.3
- Desktop OS/version used to run Appium if necessary: Windows 10
- Node.js version : v18.18.0
- Mobile platform/version under test: Android 13
- Real device or emulator/simulator: Real Device
Details
When using the annotation @AndroidFindBy(accessibility = "open menu") for an element, I'm encountering an error stating:
Unsupported CSS selector '*[name='webElementOpenMenu']'. Reason: ''name' is not a valid attribute. Supported attributes are 'checkable, checked, clickable, enabled, focusable, focused, long-clickable, scrollable, selected, index, instance, description, resource-id, text, class-name, package-name''
However, using the direct method appiumDriver.findElementByAccessibilityId("open menu").click(); works without any issues.
It appears that the accessibility attribute from the annotation is being incorrectly translated into a CSS selector with the name attribute when using AppiumFieldDecorator with EventFiringWebDriver.
Code To Reproduce Issue [ Good To Have ]
@AndroidFindBy(accessibility = "open menu")
private WebElement webElementOpenMenu;
@Test()
public void demaoTest() {
AppiumDriverLocalService appiumDriverLocalService = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.withIPAddress("127.0.0.1")
.usingPort(4723)
.withArgument(GeneralServerFlag.RELAXED_SECURITY)
.withArgument(GeneralServerFlag.SESSION_OVERRIDE)
.withArgument(GeneralServerFlag.USE_DRIVERS, "uiautomator2")
.withArgument(GeneralServerFlag.BASEPATH, "/wd/hub/")
.withArgument(GeneralServerFlag.LOG_LEVEL, "info:debug")
.withTimeout(Duration.ofSeconds(180)));
appiumDriverLocalService.start();
UiAutomator2Options uiAutomator2Options = new UiAutomator2Options()
.setAutomationName(AutomationName.ANDROID_UIAUTOMATOR2)
.setApp(System.getProperty("user.dir" + File.separator + "app" + File.separator + "android" + File.separator + "Android-MyDemoAppRN.1.3.0.build-244.apk"))
.setFullReset(false)
.setNoReset(true)
.setPlatformName("android")
.setPlatformVersion("13")
.setUdid("ZD222CJSXB")
.setAppPackage("com.saucelabs.mydemoapp.rn")
.setAppActivity("com.saucelabs.mydemoapp.rn.MainActivity");
AppiumDriver appiumDriver = new AndroidDriver(appiumDriverLocalService.getUrl(), uiAutomator2Options);
EventFiringWebDriver eventDriver = new EventFiringWebDriver(appiumDriver);
CustomEventListener listener = new CustomEventListener();
eventDriver.register(listener);
//WebElement webElementOpenMenu_1 = eventDriver.findElement(AppiumBy.accessibilityId("open menu")); --- This is working
PageFactory.initElements(new AppiumFieldDecorator(eventDriver, Duration.ofSeconds(30)), this);
webElementOpenMenu.click();
// webElementOpenMenu_1.click(); --- This is working
appiumDriver.quit();
appiumDriverLocalService.stop();
}
Exception Stacktraces
Appium Error Log:
https://gist.github.com/dipakkumar1225/619b603dbd8f9383b442b76eab343bc5
Appium Working Log:
https://gist.github.com/dipakkumar1225/d7ecf952f56ddf8a93543ae87f5667d4#file-working-txt
- Langage dominant
- Java
- Étoiles
- 1.3k
- Forks
- 755
- Merge moyen
- 5 j 14 h
- PR mergées (30 j)
- 8
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de appium/java-client
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
appium/java-client#2426 ·
Les mainteneurs répondent en général sous 5 jours
-
bug
Difficulté 4/5 3-5 jours Accessibilité débutants 50/100
appium/java-client#2372 ·
Les mainteneurs répondent en général sous 5 jours
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
appium/java-client#2368 ·
Les mainteneurs répondent en général sous 5 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 30/100
appium/java-client#2341 · 1 commentaire ·
Les mainteneurs répondent en général sous 5 jours
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
appium/java-client#2323 ·
Les mainteneurs répondent en général sous 5 jours
Toutes les issues de appium/java-client
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
refinedmods/refinedstorage2#1414 · 1 commentaire ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
In Java's `LongBoundedSum`, setting `lower` to `Long.MIN_VALUE` under-estimates the sensitivityOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
google/differential-privacy#489 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
ScyllaDB Manual: 3 broken linksOuvertelink-check link-check:manual
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100