Change default strategy for @HowToUseLocators programatically
Mantenedores costumam responder em até 5 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 30/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- java
- Domínio
- developer-experience, testing-qa
Direção de pesquisa
Comece lendo a seção Page-objects.md e o Javadoc de HowToUseLocators; em seguida, inspecione como PageFactory.initElements e AppiumFieldDecorator aplicam estratégias de localização. Defina como um padrão no nível da página deve coexistir com anotações no nível do elemento e confirme que as estratégias explícitas existentes continuam efetivas. O trabalho estará concluído quando uma única configuração no nível da página funcionar para elementos que, de outra forma, não teriam anotações e estiver coberta por testes.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
Appium provides a way to use multiple locator startegies via @HowToUseLocators annotation. The default starategy is set to LocatorGroupStrategy.CHAIN, so if we want to use the alternative strategy i.e. LocatorGroupStrategy.ALL_POSSIBLE, then we need to annotate our WebElements via
@HowToUseLocators(androidAutomation = ALL_POSSIBLE, iOSAutomation = ALL_POSSIBLE)
@FindAll{@FindBy(someStrategy1), @FindBy(someStrategy2)})
@AndroidFindBy(someStrategy1) @AndroidFindBy(someStrategy2)
@iOSFindBy(someStrategy1) @iOSFindBy(someStrategy2)
RemoteWebElement someElement;
More on this here:
https://github.com/appium/java-client/blob/master/docs/Page-objects.md#--any-possible
https://www.javadoc.io/doc/io.appium/java-client/latest/io/appium/java_client/pagefactory/HowToUseLocators.html
The problem is that we have many WebElements and almost all of them use the LocatorGroupStrategy.ALL_POSSIBLE. This means that for each of the WebElement we have to write an additional line to annotate it with @HowToUseLocators(androidAutomation = ALL_POSSIBLE, iOSAutomation = ALL_POSSIBLE). This causes alot of repetitive code which could be avoided by changing the default strategy in one place.
I am looking for a way to set the default strategy at single place, so it can be applied to all the WebElements unless it is annotated differently.
Is there a way to achieve this currently? If not, would you be interested in adding this functionality to page objects?
Environment
- Appium Java client 9.1.0
Details
Perhaps we can set this via following ways by passing an extra parameter which changes the default strategy for web elements of page:
PageFactory.initElements(new AppiumFieldDecorator(searchContext,
new TimeOutDuration(15, TimeUnit.SECONDS),
HowToUseLocators(androidAutomation = ALL_POSSIBLE, iOSAutomation = ALL_POSSIBLE)
),
pageObject
);
Code To Reproduce Issue [ Good To Have ]
Please remember: it's easier to reproduce and fix the bug with sample code.
You can git clone https://github.com/appium/appium/tree/master/sample-code or https://github.com/appium/appium/tree/master/sample-code/apps and reproduce an issue using Java and sample apps.
Also you can create a gist with pasted java code sample or put it here using markdown. About markdown please read Mastering markdown and
Writing on GitHub
Exception Stacktraces
Please create a gist with the pasted stacktrace of the exception thrown by java.
Link To Appium Logs
Please create a gist which is a paste of your full Appium logs, and link them here. Do not paste your full Appium logs here, as it will make this issue very long and hard to read!
If you are reporting a bug, always include Appium logs as linked gists! It helps to define the problem correctly and clearly.
- Linguagem predominante
- Java
- Estrelas
- 1.3k
- Forks
- 755
- Merge médio
- 5d 14h
- PRs com merge (30d)
- 8
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de appium/java-client
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
appium/java-client#2426 ·
Mantenedores costumam responder em até 5 dias
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 50/100
appium/java-client#2372 ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
appium/java-client#2368 ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 30/100
appium/java-client#2341 · 1 comentário ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
appium/java-client#2323 ·
Mantenedores costumam responder em até 5 dias
Todas as issues de appium/java-client
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
redhat-developer/intellij-quarkus#1626 ·
-
Type/Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
wso2/product-integrator-mi#5061 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
quarkiverse/quarkus-roq#1277 ·
Mantenedores costumam responder em até 1 dia
-
Typos in page footerAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
apache/logging-site#48 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/maven-surefire#3496 · 3 comentários ·
Mantenedores costumam responder em até 1 dia