How to use more than one property

I need to identify an element with 2 properties using findElementByAndroidUIAutomator identification
1 is resourceId and
2 is text

I know we can use xpath, but is there a way i use “findElementByAndroidUIAutomator” identification to use both the properties?

new UiSelector().resourceId("com.example:id/hello_world").text("hello_world")

Escape the quotes as needed.

afwang, I am looking the solution around how to use more than one property in “findElementByAndroidUIAutomator” method.

i know we can use
driver.findElementByAndroidUIAutomator(“resourceId(“blablabla”)”) but can i use something like
driver.findElementByAndroidUIAutomator(“resourceId(“blablabla”) and text(“abcd”)”)

May i know the complete statement how can i use your given command?

That is the exact string you feed into the Ui automator locator strategy.

findElementByAndroidUiAutomator("new UiSelector().resourceId(\"com.example:id/hello_world\").text(\"hello_world\")");

Wow afwang, that worked for me. Thanks a lot for your inputs.

As per the “findElementByAndroidUiAutomator” signature, we need to provide strings.
I thought we should only provide this strings as resourceId(“com.example:id/hello_world”) or text(“hello_world”)

I think there is a Java interpreter installed with the Appium bootstrap Jar, so entering Java code for the Uiautomator strategy is expected.