TestProject Forum
Powered by leading experts in the test automation community

Getting issue || Requested device was not found

I have setup TestProject.

  1. Install TestProject successfully
  2. Register Agent with Wep SDK.
  3. Created Appium Test java file and added required jar files
  4. Created Test Runner file.
  5. Connected device with System.
  6. Added devToken in Test Runner.

Run TestRunner using eclipse: Getting below exception:

19:53:37.404 [main] DEBUG io.testproject.java.sdk.v2.Runner - Starting development session…
19:53:41.088 [main] ERROR io.testproject.java.sdk.v2.Runner - Requested device was not found
java.lang.InstantiationException: Failed to start development session!
at io.testproject.java.sdk.v2.Runner.(Runner.java:161)
at io.testproject.java.sdk.v2.Runner.(Runner.java:121)
at com.test.runner.TestRunner.main(TestRunner.java:14)

Environment:

Widow 8.1
Adnroid 7.1

Please suggest on above issue

Please note example’s class io.testproject.examples.sdk.java.SessionHelper
https://github.com/testproject-io/java-sdk-examples/blob/master/Android/Runners/src/main/java/io/testproject/examples/sdk/java/SessionHelper.java#L18

// Specify target device UUID
// This information is conveniently visible at https://app.testproject.io/#/agents
// Under your connected agent on the devices tab
driverSettings.setDeviceUdid("YOUR_DEVICE_UDID");

Please follow the instruction above.

I have already updated device id in “SessionHelper” file.

Can you please post a snippet of your code and a screenshot of your Agent’s devices list?

I debug more verify, able to view devices screen from Agent tab of Web SDK.
Executed test now getting below screen:

22:06:00.550 [main] DEBUG io.testproject.java.sdk.v2.Runner - Starting development session…
22:06:07.034 [main] INFO io.testproject.java.sdk.v2.Runner - Development session initialized
22:06:07.103 [main] INFO io.testproject.java.sdk.v2.Runner - Development session connection established via local.rdr.tpagent.io:9201
22:06:11.280 [main] ERROR io.testproject.java.sdk.v2.Runner - Failed to execute codeblock class com.test.demo.ExtendedTest
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot stop and clear com.kayak.android. Original error: Error executing adbExec. Original error: ‘Command ‘‘C:\Program Files\TestProject Agent\android-sdk\platform-tools\adb.exe’ -P 5037 -s 35c14c220104 shell pm clear com.kayak.android’ exited with code 1’; Stderr: ‘Error: java.lang.SecurityException: PID 23615 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.kayak.android’; Code: ‘1’ (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.44 seconds
Build info: version: ‘unknown’, revision: ‘unknown’, time: ‘unknown’
System info: host: ‘SADIKA’, ip: ‘192.168.99.1’, os.name: ‘Windows 8.1’, os.arch: ‘x86’, os.version: ‘6.3’, java.version: ‘1.8.0_101’
Driver info: io.testproject.java.sdk.v2.drivers.AndroidDriver
Capabilities [{capabilities={appPackage=com.kayak.android, noReset=true, skipWaitAppStart=true, deviceName=xiaomi-redmi_note_4-35c14c220104, platform=ANY, appActivity=com.kayak.android.Splash, newCommandTimeout=0.0, automationName=uiautomator2, skipUnlock=true, browserName=, javascriptEnabled=true, platformName=Android, udid=35c14c220104}, javascriptEnabled=true, platform=ANY}]
Session ID: 5d0bb12e-1394-4407-a20d-885f01fb19c6
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_101]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_101]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_101]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_101]
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215) ~[io.testproject.sdk.java.jar:na]
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167) ~[io.testproject.sdk.java.jar:na]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671) ~[io.testproject.sdk.java.jar:na]
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46) ~[io.testproject.sdk.java.jar:na]
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) ~[io.testproject.sdk.java.jar:na]
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) ~[io.testproject.sdk.java.jar:na]
at io.appium.java_client.InteractsWithApps.resetApp(InteractsWithApps.java:65) ~[io.testproject.sdk.java.jar:na]
at com.test.demo.ExtendedTest.execute(ExtendedTest.java:37) ~[bin/:na]
at io.testproject.java.sdk.v2.Runner.execute(Runner.java:195) [io.testproject.sdk.java.jar:na]
at io.testproject.java.sdk.v2.Runner.run(Runner.java:420) [io.testproject.sdk.java.jar:na]
at io.testproject.java.sdk.v2.Runner.run(Runner.java:386) [io.testproject.sdk.java.jar:na]
at com.test.runner.TestRunner.main(TestRunner.java:26) [bin/:na]

One more thing I observe that if I run manually app and close during execution of test then application launch by test script, following steps:

  1. Run test
  2. launch and close app manually
  3. After closing app application launch automatically.

Can you suggest now what permission I need to give.

Thanks

Please make sure the following are enabled in Developer Options screen of your device:

  1. USB Debugging
  2. Install via USB

Thanks.

Do you have an option “USB debugging (Security Settings)- Allow granting permissions”?
If yes, is it enabled ?

Yes, I have option. will enable and check.

I enabled “USB debugging (Security Settings)- Allow granting permissions” option

but not able to run test getting below issue :

22:55:44.541 [main] DEBUG io.testproject.java.sdk.v2.Runner - Starting development session…
22:56:18.665 [main] ERROR io.testproject.java.sdk.v2.Runner - Application error occurred during the request processing, please try again
java.lang.InstantiationException: Failed to start development session!

I tried with two devices.

I am debugging issue and will keep update here.

Please post your driverSettings object you pass to the Runner.

Please find below detail:

[quote]public static DriverSettings getDriverSettings() {
    DriverSettings driverSettings = new DriverSettings();

    // Declare that Android driver is required
    driverSettings.setDriverType(DriverType.Appium_Android);

    driverSettings.setDeviceUdid("85d7e4e97ce5");

    MobileDriverSettings mobileSettings = new MobileDriverSettings();
    mobileSettings.setAndroidPackage("com.kayak.android");
    mobileSettings.setAndroidActivity(".Splash");
    driverSettings.setMobileSettings(mobileSettings);

    return driverSettings;
}[/quote]

All seems accurate.
But I can see from the logs on our end that your device is still restricted.
Errors such as INSTALL_FAILED_USER_RESTRICTED: Install canceled by user
Can you please remove any kind of blocking software, permissions guards, etc… and remove PIN/pattern locks?
You can also use an emulator as an alternative.

I did some observation and given permission in auto launch to app.

Now I noticed that test started running …

23:03:39.537 [main] DEBUG io.testproject.java.sdk.v2.Runner - Starting development session…
23:04:30.206 [main] INFO io.testproject.java.sdk.v2.Runner - Development session initialized
23:04:30.228 [main] INFO io.testproject.java.sdk.v2.Runner - Development session connection established via local.rdr.tpagent.io:3047

Glad it works. Thank you!