How to select Text in appium in android - automation

**Appium version:**
Xpath:
/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.RelativeLayout/androidx.recyclerview.widget.RecyclerView/android.widget.RelativeLayout[5]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.TextView
android.widget.TextView[#text='Test Group']"
**I am so Confuse I tried last 2 day to find solution for this my query.
How to Select my text in appium?**
**I tried many thing but Unable to click....**
List results = driver.findElements(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(" + "new UiSelector().text(\"Test Group\"))"));
((WebElement) results).click();
Result : Nothing
List<WebElement> SelectGroup = driver.findElements(By.xpath("//android.widget.LinearLayout[#resource-id='com.flipkart.android:id/product_list_product_item_layout']/android.widget.RelativeLayout[#index='1']"));
((WebElement) SelectGroup).click();
Result : Nothing
I user those Dependency List:
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>8.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Please Help me on As per latest version of APPIUM I try to fixed that error on My Code I will process by learning in Automation testing.
I show many Solution but no one is working for me.
if you need more details please ask me I will give another details

Related

the execution sequence of Simulations is not controlled

For the karate running with gatling plugin, when we specify multi Simulations in the pom like following:
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling.plugin.version}</version>
<configuration>
<simulationsFolder>src/test/java</simulationsFolder>
<runMultipleSimulations>true</runMultipleSimulations>
<includes>
<include>WorkersSimulation</include>
<include>WorkersQuerySimulation</include>
</includes>
</configuration>
</plugin>
What I expect that it executes in the sequence of my sequence in the pom, WorkersSimulation first and WorkersQuerySimulation second.
But unfortunately, looks like it picks up the simulation by alphabetic sequence, WorkersQuerySimulation first and WorkersSimulation.
Sometimes we need to control the sequence of simulations, for example: create data in first simulation and test different queries in second simulation.
So is there any way to control the sequence?
I think you can use a call in your main simulation itself to set up data, like in the demo example:
MockUtils.startServer()
Otherwise this is a question about the gatling maven plugin.

Resteasy with wildfly14: not all fields are returned

I'm migrating my application from wildfly 10 to wildfly 14 and I'm using resteasy 3.1.4 with jackson2.
I have a strange behaviour with the response of some rest services: not all the fields are returned (and I'm sure they're extracted from mongodb). The only warning I see when deploying my application is:
WFLYRS0018: Explicit usage of Jackson annotation in a JAX-RS deployment; the system will disable JSON-B processing for the current deployment. Consider setting the 'resteasy.preferJacksonOverJsonB' property to 'false' to restore JSON-B.
In the response I have two classes:
public class Field implements Serializable {
private static final long serialVersionUID = -230381150649916138L;
private String name; // returned in response
private FieldsTypeEnum type; // NOT returned in response
private List<String> comboValues; // NOT returned in response
private boolean required; // NOT returned in response
//All getters and setters
}
public class ConfigurationField extends Field {
private static final long serialVersionUID = -2727277793405725817L;
private Integer row; // returned in response
private boolean useForCalendar; // returned in response
//All getters and setters
}
Any help or suggest or idea is really appreciated
Thanks
It has been 6 months since the question was asked. However, I faced the similar issue a few days ago on Wildfly 16.
The issue was caused by JsonBindingProvider takes precedence over the other providers for dealing with JSON payloads, particular the Jackson one.
https://issues.jboss.org/browse/RESTEASY-1911
Please see documentation here.
https://github.com/resteasy/Resteasy/commit/f6ddef5accb88d924e3d14ab15e081c79136fe55
It can be fixed by 2 ways without having to update your model (POJO) objects:
Adding system property when starting up Wildfly -Dresteasy.preferJacksonOverJsonB=true
Exclude jsonb module in jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-json-binding-provider" />
</exclusions>
</deployment>
</jboss-deployment-structure>
If you do not want to change Wildfly configuration, you have to update you models to conform with JsonB specification, e.g. public your private fields in your models, or adding suitable #Jsonb annotations to your fields, ... like here, https://www.baeldung.com/java-json-binding-api.
Based on the answer from Soner, this helped me when added to web.xml:
<context-param>
<param-name>resteasy.preferJacksonOverJsonB</param-name>
<param-value>true</param-value>
</context-param>
I prefer this solution in order to keep the configuration within the app code.
I had similar problems within Wildfly 21. Adding a jboss-deployment-structure.xml like:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-json-binding-provider"/>
</exclusions>
<dependencies>
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
</dependencies>
</deployment>
</jboss-deployment-structure>
didn't help
For me the working solution was to add following line into the Wildfly standalone.conf to prefer jackson:
JAVA_OPTS="$JAVA_OPTS -Dresteasy.preferJacksonOverJsonB=true"

Latest stable revision with ivy excluding alpha & beta releases

For our project we like to have most dependecies automaticaly up to date so we want to use the lastest strategies in IVY. However we dont want to run the bleeding edge of the dependencies ie. alpha and beta versions.
When using:
<dependency org="org.apache.httpcomponents" name="httpclient" rev="latest.revision" />
or
<dependency org="org.apache.httpcomponents" name="httpclient" rev="latest.release" />
We get revision 4.4-alpha1
This is understandable as we use the ibiblio resolver which contains the following xml in maven-metadata.xml
<metadata>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<versioning>
<latest>4.4-alpha1</latest>
<release>4.4-alpha1</release>
<versions>
<version>4.0-alpha1</version>
<!-- snip --->
<version>4.3-alpha1</version>
<version>4.3-beta1</version>
<version>4.3-beta2</version>
<version>4.3</version>
<version>4.3.1</version>
<version>4.3.2</version>
<version>4.3.3</version>
<version>4.3.4</version>
<version>4.3.5</version>
<version>4.4-alpha1</version>
</versions>
<lastUpdated>20140801101402</lastUpdated>
</versioning>
</metadata>
The meta data indicates the alpha version as both release and latest. (not sure if this is related actualy)
In this case we there is a version we would like to get in the metadata list being 4.3.5
Now ivy has a construct with and but the documentation is quite sparse, and i cant figure out how to make this strategy 'ignore' the alpha release.
I tried variation of the following to no avail (using rev="latest.test") :
`
Edit:
From the source code of org.apache.ivy.plugins.latest.LatestRevisionStrategy it appears specialmeanings wont be able to solve this since the version is first split in parts and then compared on a part by part basis.
If there is a way to forbid revisions that contain a specific string my problem would also be solved.
`
The source code of org.apache.ivy.plugins.latest.LatestRevisionStrategy indicated it's impossible to fix this with special-meaning strings in a latestStrategy element. (thanks to: this post)
we ended up using a version matcher to enforse ivy to not use -beta- or -alpha releases.
Its not an optimal solution and the regexp probably needs to be updated a few times still.
in ivysettings.xml:
<version-matchers usedefaults="true">
<pattern-vm name="lastest.nobeta">
<match revision="latest.nobeta" pattern="\.*\d+\.\d+\.?\d*(FINAL|RELEASE|STABLE)?" matcher="regexp" />
</pattern-vm>
</version-matchers>
and in ivy.xml:
<dependency org="org.apache.poi" name="poi" rev="latest.nobeta"/>
Not entirely sure if this takes the lastest version but so far that seems to be the case.

Inject property into JPA orm.xml?

We are splitting our baseline (for release 1.0 and 2.0 concurrent development). Instead of maintaining two separate databases (and hardware), we are investigating other alternatives. We would like to be able to use the same instance of a database, and have duplicate copies of the tables/data in two different schemas:
1.0: SCHEMA_1
2.0: SCHEMA_2
The JPA orm.xml file has a property where the schema is specified:
<schema>SCHEMA_1</schema>
My question is whether a property can be injected instead of a hard coded schema name (and how).
For example, if we have a .properties file with the following:
schema.name=SCHEMA_1
Can we then use schema.name in the orm.xml file like this:
<SCHEMA>schema.name</SCHEMA>
Thanks for any help! Other alternatives for making the schema dynamic are also welcome.
JPA only defines this in the orm.xml.
In EclipseLink you can use a SessionCustomizer to set this on your EclipseLink Session in code,
session.getLogin().setTableQualifier("SCHEMA_1");
We ended up using the velocity-maven-plugin to replace tags for the schema at build-time.
In orm.xml template:
<schema>${schemaName}</schema>
In the pom file:
<plugin>
<groupId>net.rumati.maven.plugins</groupId>
<artifactId>velocity-maven-plugin</artifactId>
<version>0.1.1</version>
<executions>
<execution>
<id>replaceSchema</id>
<phase>generate-sources</phase>
<goals>
<goal>velocity</goal>
</goals>
</execution>
</executions>
<configuration>
<template>${basedir}/src/main/resources/hibernate/template/orm.xml</template>
<properties>
<schemaName>${r1Schema}</schemaName>
</properties>
<outputFile>${basedir}/src/main/resources/hibernate/orm.xml</outputFile>
</configuration>
</plugin>
I've been faced with the exact problem. Instead of building the orm.xml in to the project, leave it out of the artifact build. Then at runtime, put it on the classpath of the application so it's picked up:
<persistence-unit-metadata>
<persistence-unit-defaults>
<schema>MySchemaThatsBeenDeterminedAtRuntime</schema>
</persistence-unit-defaults>
</persistence-unit-metadata>
Each instance of application can have it's own orm.xml and point to a different schema.

Override Maven's default resource filter replacement pattern

By default maven will filter resources like this:
<properties>
<replace.me>value</replace.me>
</properties>
<some-tag>
<key>${replace.me}</key>
</some-tag>
will get you:
<some-tag>
<key>value</key>
</some-tag>
Is there a way to override the way maven selects the strings to replace? Specifically, I want to be able to use this:
<some-tag>
<key>#replace.me#</key>
</some-tag>
to get the same result as above.
Have a look at the delimiters parameter of the resources mojo. Configuring the plugin like this will do the trick:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<delimiters>
<delimiter>${*}</delimiter><!-- to keep the default behavior -->
<delimiter>#</delimiter><!-- to add Ant-like tokens style -->
</delimiters>
</configuration>
</plugin>
If you would like to use only one approach then disable default delimeters:
<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
<delimiter>#</delimiter>
</delimiters>