Tanmoy Ray
Tanmoy Ray

Reputation: 23

how can i test my xpath has identified right element on android/iOS native application

Android User Name field Details: content-desc: type: android.widget.EditText text: Username index: 0 enabled: true location: {30, 293} size: {480, 60} checkable: false checked: false focusable: true clickable: true long-clickable: true package: com.senrysa.parkingplace password: false resource-id: com.senrysa.parkingplace:id/LoginUserName scrollable: false selected: false xpath: //android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.ScrollView[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[2]/android.widget.EditText[1]

I have created partial xpath with attribute text ... i.e. xpath = "//android.widget.EditText[@text='Username']")

but it has not worked.

how can i test my xpath has identified right element on android/iOS native application?

Upvotes: 0

Views: 501

Answers (3)

Tanmoy Ray
Tanmoy Ray

Reputation: 23

@Narendra

I have checked through XPath Tester... and it worked properly .

but

when we use @AndroidFindBy(xpath = ("//android.widget.EditText[@text='Username']")) has not worked

Is @AndroidFindBy identified by this xpath where as absolute xpath has worked properly.

Upvotes: 0

Narendra Chandratre
Narendra Chandratre

Reputation: 921

When you just want to confirm xpath for particular element, You should try below action:

  • click if button/link
  • sendKeys if inputfield
  • check/un-check if checkbox

I guess, this would be the simplest way to verify @Tanmay

Upvotes: 0

BludShot
BludShot

Reputation: 301

You can try to increase the implicit wait time for your WebDriver so it doesn't error out before the element is visible.

Please share your code snippet and error stack for precise solutuion.

Upvotes: 0

Related Questions