Forum Discussion
Hi,
Try to use the TryToSetCurrent() method. I.e. instead of
Mobile["Refresh"]()
if(Mobile["Device"](device)["Exists"]==true)
use
if(Mobile["TryToSetCurrent"](device))
...
and move
Mobile["Refresh"]()
to the end of the
while(aqDateTime["Now"]()<endtime)
loop in order not to do unnecessary refresh if the device is already found.
Does it help?
- anhvu10 years agoFrequent Contributor
Hi Alexkaras,
Thank you for your suggestion but it didn't help. It happened because sometimes testcomplete doesn't recognize the device.
I just update my script and it works as expected.
adding: check the property is empty or null, if null I will refesh the usb port and check it again.
So far, it works for me.
- AlexKaras10 years agoCommunity Hero
Hi,
Thank you for the update.
Yes, for some reason TestComplete (or adb?) sometimes loses connection to the device.
> [...] if null I will refesh the usb port and check it again.
Just wondering if you do this programmatically within your test code or just manually reconnect the device?
- anhvu10 years agoFrequent Contributor
AlexKaras,
I did it automatically with the script as below:
I launch CMD and run the command line "adb usb"