alttester / AltTester-Unity-SDK

AltTester Unity SDK is an open-source UI driven test automation tool that helps you find objects in your game and interacts with them using tests written in C#, Python, Robot or Java.
https://alttester.com/docs/sdk/latest/home.html
GNU General Public License v3.0
63 stars 9 forks source link

Unable to fetch the elements: AltDriver(Java) #181

Closed AltTesterBot closed 2 years ago

AltTesterBot commented 2 years ago

In what language are the test written? Java

What version of AltUnityTester are you using? 1.2.1 (Latest, downloaded on 8/19/2019)

On what device are you trying to run the test? Android - Pixel 2 emulator

The OS from where you are running the test? Windows

Summary

on calling altUnityDriver.getCurrentScene() it's working as expected, but on calling altUnityDriver.getAllElements() or any altUnityDriver.findObject/s() methods, ro.altom.altunitytester.altUnityTesterExceptions.CouldNotPerformOperationException exception is thrown.

Steps to reproduce

Followed below links to use the AltUnityTester for java

AltUnityTester java Binding

Altunity Setup

Relevant logs and/or screenshots

"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2\lib\idea_rt.jar=50752:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2\plugins\testng\lib\testng-plugin.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar;C:\Users\user\IdeaProjects\AltunityTester_test\target\test-classes;C:\Users\user\Desktop\altunitytester-java-client-1.4.0-SNAPSHOT-jar-with-dependencies.jar;C:\Users\user.m2\repository\io\appium\java-client\7.1.0\java-client-7.1.0.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-java\4.0.0-alpha-1\selenium-java-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\4.0.0-alpha-1\selenium-chrome-driver-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-edge-driver\4.0.0-alpha-1\selenium-edge-driver-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-firefox-xpi-driver\4.0.0-alpha-1\selenium-firefox-xpi-driver-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\4.0.0-alpha-1\selenium-firefox-driver-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-ie-driver\4.0.0-alpha-1\selenium-ie-driver-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-opera-driver\4.0.0-alpha-1\selenium-opera-driver-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-safari-driver\4.0.0-alpha-1\selenium-safari-driver-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-support\4.0.0-alpha-1\selenium-support-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\4.0.0-alpha-1\selenium-remote-driver-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\net\bytebuddy\byte-buddy\1.9.12\byte-buddy-1.9.12.jar;C:\Users\user.m2\repository\org\apache\commons\commons-exec\1.3\commons-exec-1.3.jar;C:\Users\user.m2\repository\com\google\guava\guava\27.1-jre\guava-27.1-jre.jar;C:\Users\user.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\user.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\user.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\user.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\user.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\user.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\user.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\user.m2\repository\com\squareup\okhttp3\okhttp\3.14.0\okhttp-3.14.0.jar;C:\Users\user.m2\repository\com\squareup\okio\okio\1.17.2\okio-1.17.2.jar;C:\Users\user.m2\repository\org\seleniumhq\selenium\selenium-api\4.0.0-alpha-1\selenium-api-4.0.0-alpha-1.jar;C:\Users\user.m2\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;C:\Users\user.m2\repository\org\apache\httpcomponents\httpclient\4.5.8\httpclient-4.5.8.jar;C:\Users\user.m2\repository\org\apache\httpcomponents\httpcore\4.4.11\httpcore-4.4.11.jar;C:\Users\user.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\user.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\user.m2\repository\cglib\cglib\3.2.10\cglib-3.2.10.jar;C:\Users\user.m2\repository\org\ow2\asm\asm\7.0\asm-7.0.jar;C:\Users\user.m2\repository\org\apache\ant\ant\1.10.3\ant-1.10.3.jar;C:\Users\user.m2\repository\org\apache\ant\ant-launcher\1.10.3\ant-launcher-1.10.3.jar;C:\Users\user.m2\repository\commons-validator\commons-validator\1.6\commons-validator-1.6.jar;C:\Users\user.m2\repository\commons-beanutils\commons-beanutils\1.9.2\commons-beanutils-1.9.2.jar;C:\Users\user.m2\repository\commons-digester\commons-digester\1.8.1\commons-digester-1.8.1.jar;C:\Users\user.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\user.m2\repository\org\apache\commons\commons-lang3\3.9\commons-lang3-3.9.jar;C:\Users\user.m2\repository\commons-io\commons-io\2.6\commons-io-2.6.jar;C:\Users\user.m2\repository\org\springframework\spring-context\5.1.6.RELEASE\spring-context-5.1.6.RELEASE.jar;C:\Users\user.m2\repository\org\springframework\spring-aop\5.1.6.RELEASE\spring-aop-5.1.6.RELEASE.jar;C:\Users\user.m2\repository\org\springframework\spring-beans\5.1.6.RELEASE\spring-beans-5.1.6.RELEASE.jar;C:\Users\user.m2\repository\org\springframework\spring-core\5.1.6.RELEASE\spring-core-5.1.6.RELEASE.jar;C:\Users\user.m2\repository\org\springframework\spring-jcl\5.1.6.RELEASE\spring-jcl-5.1.6.RELEASE.jar;C:\Users\user.m2\repository\org\springframework\spring-expression\5.1.6.RELEASE\spring-expression-5.1.6.RELEASE.jar;C:\Users\user.m2\repository\org\aspectj\aspectjweaver\1.9.3\aspectjweaver-1.9.3.jar;C:\Users\user.m2\repository\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;C:\Users\user.m2\repository\org\testng\testng\6.14.3\testng-6.14.3.jar;C:\Users\user.m2\repository\com\beust\jcommander\1.72\jcommander-1.72.jar;C:\Users\user.m2\repository\org\apache-extras\beanshell\bsh\2.0b6\bsh-2.0b6.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2\plugins\testng\lib\jcommander-1.27.jar" org.testng.RemoteTestNGStarter -usedefaultlisteners false -socket50751 @w@C:\Users\user\AppData\Local\Temp\idea_working_dirs_testng.tmp -temp C:\Users\user\AppData\Local\Temp\idea_testng.tmp

Aug 19, 2019 3:14:18 AM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0 INFO: Detected dialect: W3C 2019-08-19 03:14:29 INFO AltUnityDriver:958 - Setting up port forward for android on port 13000 2019-08-19 03:14:29 WARN AltUnityDriver:997 - AltUnityServer - no iproxy process was running/present java.io.IOException: Cannot run program "killall": CreateProcess error=2, The system cannot find the file specified 2019-08-19 03:14:30 INFO AltUnityDriver:1004 - Removed existing adb forwarding... 2019-08-19 03:14:31 INFO AltUnityDriver:969 - adb forward enabled.

2019-08-19 03:14:31 INFO AltUnityDriver:80 - Sending rpc message [getCurrentScene;&] altUnityDriver.getCurrentScene() = Scene 1 AltUnityDriverTestScene 2019-08-19 03:14:32 INFO AltUnityDriver:80 - Sending rpc message [findObjects;//*;;true;&]

ro.altom.altunitytester.altUnityTesterExceptions.CouldNotPerformOperationException: error:couldNotPerformOperation

    at ro.altom.altunitytester.AltUnityDriver.handleErrors(AltUnityDriver.java:936)
    at ro.altom.altunitytester.AltUnityDriver.getAllElements(AltUnityDriver.java:490)
    at ro.altom.altunitytester.AltUnityDriver.getAllElements(AltUnityDriver.java:503)
    at SampleTest.testTapOnButton(SampleTest.java:57)
    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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:648)
    at org.testng.TestRunner.run(TestRunner.java:505)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
    at org.testng.TestNG.runSuites(TestNG.java:1049)
    at org.testng.TestNG.run(TestNG.java:1017)
    at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)

2019-08-19 02:21:03 INFO AltUnityDriver:86 - Closing connection with server. 2019-08-19 02:21:03 INFO AltUnityDriver:80 - Sending rpc message [closeConnection;&]

=============================================== All Test Suite Total tests run: 1, Failures: 1, Skips: 0

SampleTest.java

Process finished with exit code 0


You can find the original issue from GitLab here.

AltTesterBot commented 2 years ago

Hi @krishna.sk77, I tried to run the same thing as you did and for me it worked. Could it be that you downloaded the latest driver for java but the server that is in apk is an older version?


You can find the original comment from GitLab here.

AltTesterBot commented 2 years ago

Closing this issue due to not having enough information to troubleshoot. Please re-open this issue if similar situation or new information are offered.


You can find the original comment from GitLab here.