-1

There must be a very easy solution to my question, which i am unable to figure out. UIAutomatorViewer gives information of object, which can be used for Appium. Following is the example for Appium: xpath("//android.widget.Button[contains(@resource-id,'digit5')]")

See more at: http://software-testing-tutorials-automation.blogspot.ca/2015/10/ui-automator-viewer-get-android-app.html#sthash.ii6U2aHA.dpuf

I am using Selendroid, what will be the equivalent format for it to use xpath?

Naman
  • 27,789
  • 26
  • 218
  • 353
Salman Arshad
  • 59
  • 1
  • 14

2 Answers2

0

A straight and simple answer to this is :

X-Path syntax would remain the same.

Naman
  • 27,789
  • 26
  • 218
  • 353
  • xpath("//android.widget.Button[@text='5']") This x-path is not working for my application which I am trying to automate on Selendroid. "//android.widget.Button " is a class, and I am unable to use it for Selendroid. I am using UIAutomatorViewer to extract this information. – Salman Arshad Mar 31 '16 at 14:35
  • @SalmanArshad : could you share the block of code that you are trying. Please add it to the question itself. – Naman Mar 31 '16 at 17:36
  • Here is an example: **SELENDROID:** This is working for Selendroid. `(driver.findElement(By.linkText("Access for all guest users")).click();` but not working for Appium **APPIUM:** `driver.findElement(By.xpath("(//android.view.View[@content-desc='Access for all Bell Media Guest users'])")).click();` is functional – Salman Arshad Apr 06 '16 at 14:37
  • `By.linkText` is another locator strategy while `By.xpath` is different. It complicates your question. – Naman Apr 06 '16 at 14:40
  • **APPIUM:** `driver.findElement(By.xpath("(//android.view.View[@content-desc='Access for all Bell Media Guest users'])")).click();` is functional but dose not work for selendroid – Salman Arshad Apr 06 '16 at 14:43
  • just check for a device where you want to use selendroid, does the x-path value remains the same or not – Naman Apr 06 '16 at 14:46
0

X-Path remains the same, however Selendroid vs APPIUM response to object differently. Appium handles the object on pop-up. Where selendroid needs to change the focused on pop up window to find the object/element.

Salman Arshad
  • 59
  • 1
  • 14