Appium: any job to use item identifiers to automate the application

I use Appium to test a mobile application. When I use xpath, it works fine, but I cannot work with identifiers for this application.

//This is working fine

remoteDriver.findElementByXPath("/linear[1]/window[2]/linear[1]/linear[1]/linear[2]/linear[1]/text[2]").click(); // Click on signIn button 

// This doesn't recognize the element

remoteDriver.findElementById("ButtonSignIn").click(); // Click on signIn button

If anyone has experience using appium with identifiers, please share your experience.

thanks

+4
source share
6 answers

API- 18 (Jelly Bean). uiautomatorviewer, Node Details "resource-id", , API android, 18. , , - xpath, tagName, className .. - https://github.com/appium/appium/blob/master/docs/finding-elements.md

+3

Appium "id" Android :

remoteDriver.findElementById("com.exampleCompany.appName:id/ButtonSignIn").click();

, Appium, - ListView. " " Android, Android, .

, ListView, , , , Appium, " ."

+1

. "ButtonSignIn", "com.company.app:id/ButtonSignIn".

:

remoteDriver.findElementById("com.company.app:id/ButtonSignIn").click();

, layout.xml ID android: id = "@+ id/ButtonSignIn" ( - com.company.app), "com. company.app:id/ButtonSignIn" "ButtonSignIn".

find by ID Appium, Selendroid, .

0

ids FindElementsByClassName ( "abc.widget.EditText" ) () FindElement (By.Name( "" )

... 1... , . : [1].Sendkeys( "1234" )

0

findElement (By.id("")). :

remoteDriver.findElement(By.id("ButtonSignIn")).click();

He worked for me so far.

0
source

Use android uiautomatorviewer to get the correct android item id. Click the link below:

Is it possible to find an element by ID in appium

0
source

All Articles