Xpath generated from 'Appium studio' is not working in 'Appium' standalone server

Hi Team,

I have taken xPath from Appium studio’s spy object, script is working fine and elements are found when I execute using Appium Studio’s Appium server but when I close ‘Appium studio’, start ‘Appium’ standalone and execute script it shows error like below, same code is working fine with Appium studio’s appium server.

org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.85 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Ankit-PC', ip: '192.168.42.13', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.sharkid, deviceScreenSize=720x1280, networkConnectionEnabled=true, noReset=true, warnings={}, reportFormat=xml, databaseEnabled=false, deviceName=3a2895d, platform=LINUX, deviceUDID=3a2895d, appActivity=.activities.ActivitySplashStart, desired={appPackage=com.sharkid, appActivity=.activities.ActivitySplashStart, noReset=true, reportDirectory=reports, reportFormat=xml, udid=3a2895d, platformName=Android, deviceName=Yureka, testName=Untitled}, platformVersion=7.1.2, webStorageEnabled=false, locationContextEnabled=false, takesScreenshot=true, reportDirectory=reports, javascriptEnabled=true, deviceModel=AO5510, udid=3a2895d, platformName=Android, deviceManufacturer=YU, testName=Untitled}]
Session ID: 25ad1b48-b567-4ad2-a892-bdac2b5acd24
*** Element info: {Using=xpath, value=//*[@contentDescription='Drawer Open']}
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
	at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:56)
	at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
	at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:500)
	at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:134)
	at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
	at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
	at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
	at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
	at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:52)
	at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
	at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
	at com.sharkid.bizcard.Index.Untitled.testUntitled(Untitled.java:38)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Hi Ankit

Why are you closing Appium Studio and execute against the standard server?

why won’t you use Appium studio for your execution as-well?

Tom

Have the same problem.
I want to use code, that generated from appium studio at the appium standalone server.
Appium standalone server runs from the script with my test.
Xpath generated from Appium Studio is not working.

Hey ms99,
Could you elaborate on your test configuration and setup?
In Appium Studio, are you using the “instrumented” feature?
If so that might be causing the issue since Appium server cannot see the instrumented properties of the elements.

@Mor.Experitest

Can you please help me with these questions…

Installation Should be Instrumented or Non Instrumented??
Launch Should be Instrumented or Non Instrumented??
Object Identification should be Intrumented or Non Instrumented?

Hi
I am very new to Appium
Has anyone got a resolution for it. I am facing the same issue.

Dear All,

I would like to partly answer the questions and partly ask for a reviewer or moderator to correct me if I am wrong.

Instrumented feature of appium studio mainly helps with Webview. In other words, hybrid applications. Example in the mobile app I am working with, there is an Azure Microsoft Login embedded making it a hybrid app. The object spy if not instrumented does not show the XPath for the Azure Login field and Password field. In other words, the whole Azure Login is shown as one big blur in yellow and does not let you click on the Username / Password text field to derive the XPath. Instrumenting the App helps to get to the webview fields of the Hybrid App and retrieve the XPath.

Hence, when a C# NUnit test code is executed, having the Appium Server / Executor Agent running runs the Appium tests successfully.

In a Continous Integration environment such as say Team City Continous Integration Server, Appium Studio needs to be installed and the internal executor agent need to be running on port 4723.

It would be great to hear back.

Many thanks,
Raghavan