appium icon indicating copy to clipboard operation
appium copied to clipboard

[debug] [UiAutomator] Moving to state 'stopped'

Open wangtao169447 opened this issue 9 years ago • 5 comments

The problem

I have write a test case ,which work well. however, when i unplug the USB line,the test case throw exceptions.(i useed "adb logcat -c && adb logcat -v time *:W" and "self.driver.page_source" function in my test case)

The client log is:

[Logcat] Logcat terminated with code 0, signal null
[UiAutomator] UiAutomator exited unexpectedly with code 0, signal null
[MJSONWP] Encountered internal error running command: Error: UiAUtomator shut down unexpectedly
    at AndroidBootstrap.callee$2$0$ (../../lib/bootstrap.js:76:44)
    at tryCatch (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:100:21)
    at invoke (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:136:37)
    at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:185:17)
    at Promise.F (/usr/local/lib/node_modules/appium/node_modules/.1.2.7@core-js/library/modules/$.export.js:30:36)
    at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:100:21)
    at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:209:12)
    at UiAutomator.callee$2$0 (../../lib/bootstrap.js:73:64)
    at emitOne (events.js:96:13)
    at UiAutomator.emit (events.js:188:7)
    at UiAutomator.changeState (lib/uiautomator.js:85:10)
    at SubProcess.<anonymous> (lib/uiautomator.js:47:14)
    at emitTwo (events.js:106:13)
    at SubProcess.emit (events.js:191:7)
    at ChildProcess.<anonymous> (../../lib/teen_process.js:205:14)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

The client log is:

Traceback (most recent call last):
  File "test.py", line 1608, in execute_flow_list
    cur_page_source = self.driver.page_source
  File "/Library/Python/2.7/site-packages/selenium-2.52.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 464, in page_source
    return self.execute(Command.GET_PAGE_SOURCE)['value']
  File "/Library/Python/2.7/site-packages/selenium-2.52.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 201, in execute
    self.error_handler.check_response(response)
  File "build/bdist.macosx-10.11-intel/egg/appium/webdriver/errorhandler.py", line 29, in check_response
    raise wde
WebDriverException: Message: A session is either terminated or not started

The Server log is:

[HTTP] <-- GET /wd/hub/session/3168e0df-3799-4c4f-b955-21c46ce6091f/element/16/location 200 28 ms - 87 
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [AndroidDriver] Shutting down Android driver
[Appium] Closing session, cause was 'UiAUtomator shut down unexpectedly'
[Appium] Removing session 3168e0df-3799-4c4f-b955-21c46ce6091f from our master session list
[debug] [AndroidDriver] Resetting IME to io.appium.android.ime/.UnicodeIME
[debug] [ADB] Getting connected devices...
[debug] [ADB] 0 device(s) connected
[HTTP] --> GET /wd/hub/session/3168e0df-3799-4c4f-b955-21c46ce6091f/source {}
[HTTP] <-- GET /wd/hub/session/3168e0df-3799-4c4f-b955-21c46ce6091f/source 404 1 ms - 131 
[HTTP] --> GET /wd/hub/session/3168e0df-3799-4c4f-b955-21c46ce6091f/source {}
[HTTP] <-- GET /wd/hub/session/3168e0df-3799-4c4f-b955-21c46ce6091f/source 404 1 ms - 131 
[HTTP] --> GET /wd/hub/session/3168e0df-3799-4c4f-b955-21c46ce6091f/source {}
[HTTP] <-- GET /wd/hub/session/3168e0df-3799-4c4f-b955-21c46ce6091f/source 404 1 ms - 131 

Environment

  • Appium version (or git revision) that exhibits the issue:1.6.3
  • Last Appium version that did not exhibit the issue (if applicable):no
  • Desktop OS/version used to run Appium:Mac OS
  • Node.js version (unless using Appium.app|exe):
  • Mobile platform/version under test:Android
  • Real device or emulator/simulator:Real Devices
  • Appium CLI or Appium.app|exe: Appium CLI

@mykola-mokhnach @imurchie thanks for watching ,and looking for your help .

wangtao169447 avatar Apr 12 '17 15:04 wangtao169447

when i unplug the USB line

What is the purpose of doing that?

mykola-mokhnach avatar Apr 12 '17 16:04 mykola-mokhnach

What is the purpose of doing that?

I use unlpug the USB line and replug the USB line to simulate the lost connection and reconnection with the real device by wifi mode(adb tcpip; adb connect).and i hope the appium can continue to work when reconnect with the real device.

I use wifi mode to connect with real devices(adb tcpip; adb connect ), and i found that sometimes PC will lost connect with the real device。 When i facing this situation, i will execute "adb connect xx.xx.xx.xx:port" to reconnect with real device . however , i found which does't work.(I wonder if the ip and port of the real device not change , what can i do to reconnect the real device ,and continue to execute next appium task)

@mykola-mokhnach

wangtao169447 avatar Apr 13 '17 03:04 wangtao169447

Unfortunately this is not going to work, since you also terminate connection to the UIAutomation server by doing that. However, you may use http://appium.io/slate/en/master/?java#adjusting-network-connection interface. Please note, that only enable/disable wi-fi functionality is 100% supported on real devices. Airplane mode switching is only supported for Android 6 and older, but will not work on newer OS versions.

mykola-mokhnach avatar Apr 13 '17 06:04 mykola-mokhnach

Unfortunately this is not going to work, since you also terminate connection to the UIAutomation server by doing that.

how about reconnection to the UIAutomation server? is there anyways to support this ? if we can reconnection to the UIAutomation server, the appium can continue to work when reconnect with the real device(first we lost connect with real device ,and then we reconnect with the real device)?

wangtao169447 avatar Apr 13 '17 07:04 wangtao169447

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Apr 26 '19 13:04 lock[bot]