Forum Discussion

vikram_u_k's avatar
vikram_u_k
Contributor
8 years ago
Solved

Get the Response from Commandline

Hi,

With TestComplete Android using python, i am trying to get the Date from one of the connected Systems to get the System date

 

Testedapp is linked to ADB exe:

 

  TestedApps.adb.Params.ActiveParams.CommandLineParameters = "-s DEVNAME shell date"
  TestedApps.adb.Run() .

 

How do i get the return value from the execution of this commandline?.

 

 

 

  • Hi Vikram,

     

    To run ADB shell commands on an Android device, you should use the Device.ShellExecute method:

    def Test():
      Mobile.SetCurrent("emulator-5554")
      strDate = Mobile.Device().ShellExecute("date") # Do not prefix commands with "adb shell"
    
      Log.Message(strDate)

    # Result:
    # Thu May 26 11:56:37 GMT 2016

1 Reply

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi Vikram,

     

    To run ADB shell commands on an Android device, you should use the Device.ShellExecute method:

    def Test():
      Mobile.SetCurrent("emulator-5554")
      strDate = Mobile.Device().ShellExecute("date") # Do not prefix commands with "adb shell"
    
      Log.Message(strDate)

    # Result:
    # Thu May 26 11:56:37 GMT 2016