bitbar / test-samples

Sample test scripts and applications for Bitbar Cloud
https://docs.bitbar.com/testing/index.html
Apache License 2.0
109 stars 222 forks source link

Getting as "java.io.IOException: Cannot run program "screenshot2": error=20, Not a directory" while using the takeScreenshot() method from Image recoginisation class #209

Closed adityabhargav closed 3 years ago

adityabhargav commented 3 years ago

When I call takeScreenshot() method ., it's working fine, and able to receive the screenshot in the desired path ., But when I call the method like findImageOnScreen() or tapImageOnScreen() which recalls takeScreenshot() method is getting an issue at screenshot2 with javaIOexeception which it works earlier.

Project Link:- https://github.com/bitbar/test-samples/tree/master/samples/testing-frameworks/appium/server-side/image-recognition

Device :- Google Pixel

Kindly refer to the error log below

error logs

   java.io.IOException: Cannot run program "screenshot2": error=20, Not a directory

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:485)
at imagerecognition.ImageRecognition.takeAndroidScreenshot(ImageRecognition.java:250)
at imagerecognition.ImageRecognition.takeScreenshot(ImageRecognition.java:235)
at imagerecognition.ImageRecognition.findImageLoop(ImageRecognition.java:199)
at imagerecognition.ImageRecognition.findImageOnScreen(ImageRecognition.java:184)
at TestdroidImageRecognition.findImageOnScreen(TestdroidImageRecognition.java:140)
at TestdroidImageRecognition.tapImageOnScreen(TestdroidImageRecognition.java:162)
at TestdroidImageRecognition.tapImageOnScreen(TestdroidImageRecognition.java:185)
at AppiumExxec.mainPageTest(AppiumExxec.java:61)
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.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
    Caused by: java.io.IOException: error=20, Not a directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.