info: Getting focused package and activity (despite app-wait-activity)

552 views
Skip to first unread message

Johan Lundström

unread,
Nov 28, 2013, 1:03:14 PM11/28/13
to appium-...@googlegroups.com
Hello everyone. I've been lurking for a while and this is my first time posting.

I am running Appium from source (latest commit 95e70081bec29f3e5250cec4cd40b53ac3f3d03e) in OS X 10.9 for both iOS and Android.
I have never been able to use the Appium app (with the inspector) successfully for Android but I have had some success with the command line and python.

Recently all of my tests fail in the setup with (this goes on until it times out):
info: Getting focused package and activity

I read up on app-wait-activity and added it (even to the example code) but it just does not do the trick like it did for other people online.
In the case of android.py:
desired_caps = {}
desired_caps['device'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.2'
desired_caps['app'] = PATH(
    '../../../sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk'
)
desired_caps['app-package'] = 'com.example.android.apis'
desired_caps['app-activity'] = '.ApiDemos'
desired_caps['app-wait-activity'] = '.ApiDemos'

Now, these are tests that used to work. I haven't changed my code but I did pull new code for Appium. Regression?
Any help would be very much appreciated.

Best,
/Johan

I launch the server with:
> appium &

I launch the supplied examples with:
> python android.py

Here is the output from pyhon:
➜  python git:(master) ✗ python android.py
Traceback (most recent call last):
  File "android.py", line 21, in <module>
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
    self.error_handler.check_response(response)
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'A session is either terminated or not started (Original error: App never showed up as active. appActivity: .ApiDemos t49 != .ApiDemos)'

And here is the output from Appium:
➜  ~  appium &
[1] 3024
➜  ~  info: Welcome to Appium v0.10.1 (REV d0827d6b2507c982802d02b2c6d2bb4d6906bdb3)
info: Appium REST http interface listener started on 0.0.0.0:4723
   info  - socket.io started
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"sessionId":null,"desiredCapabilities":{"app-package":"com.example.android.apis","app":"/Users/lujo/dev/appium/sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk","browserName":"","version":"4.2","device":"Android","app-activity":".ApiDemos"}}
info: Using local app from desiredCaps: /Users/lujo/dev/appium/sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk
info: Creating new appium session 4476394f-c48d-47c7-9916-bca166af3210
info: Starting android appium
debug: Using fast reset? true
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from /Users/lujo/dev/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
info: [ADB] 1 device(s) connected
info: [ADB] Setting device id to 004dd7b2cd93a422
info: Found device, no need to retry
info: [ADB] Waiting for device 004dd7b2cd93a422 to be ready and to respond to shell commands (timeout = 5)
info: Starting logcat capture
info: Checking whether we need to run fast reset
debug: Checking app cert for /tmp/com.example.android.apis.clean.apk: java -jar "/usr/local/lib/node_modules/appium/app/android/verify.jar" "/tmp/com.example.android.apis.clean.apk"
debug: App already signed.
debug: Checking app cert for /Users/lujo/dev/appium/sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk: java -jar "/usr/local/lib/node_modules/appium/app/android/verify.jar" "/Users/lujo/dev/appium/sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk"
debug: App already signed.
debug: App signed? true /Users/lujo/dev/appium/sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk
debug: java -jar "/usr/local/lib/node_modules/appium/app/android/strings_from_apk.jar" "/Users/lujo/dev/appium/sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk" "/tmp/com.example.android.apis"
info: [ADB] Not uninstalling app since server not started with --full-reset
info: Determining app install/clean status
debug: Getting install/clean status for com.example.android.apis
debug: Running fast reset clean: "/Users/lujo/dev/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb" -s 004dd7b2cd93a422 shell am instrument com.example.android.apis.clean/clean.apk.Clean
info: [ADB] Forwarding system:4724 to device:4724
info: [ADB] Pushing appium bootstrap to device...
info: [ADB] Pushing unlock helper app to device...
info: Running bootstrap
info: "/Users/lujo/dev/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb" -s 004dd7b2cd93a422 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
info: [ADB STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [ADB STDOUT] INSTRUMENTATION_STATUS: stream=
info: [ADB STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [ADB STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [ADB STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [ADB STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [ADB STDOUT] INSTRUMENTATION_STATUS: current=1
info: [ADB STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [ANDROID] [info] Socket opened on port 4724
info: [ADB] Connecting to server on device on port 4724...
info: [ANDROID] [info] Appium Socket Server Ready
info: [ANDROID] [info] Loading json...
info: [ADB] Connected!
info: [ADB] Waking up device if it's not alive
info: Pushing command to appium work queue: ["wake",{}]
info: [ADB] Sending command to android: {"cmd":"action","action":"wake","params":{}}
info: [ANDROID] [info] json loading complete.
info: [ANDROID] [info] Client connected
info: [ANDROID] [info] Got data from client: {"cmd":"action","action":"wake","params":{}}
info: [ANDROID] [info] Got command of type ACTION
info: [ANDROID] [debug] Got command action: wake
info: [ANDROID] [info] Returning result: {"value":true,"status":0}
info: [ADB] Received command result from bootstrap
info: [ADB] Checking if screen is unlocked via `dumpsys window`...
info: [ADB] Attempting to unlock screen by starting Unlock app...
info: [ADB] Checking if screen is unlocked via `dumpsys window`...
info: Starting app
info: [ADB] Starting app
"/Users/lujo/dev/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb" -s 004dd7b2cd93a422 shell am start -n com.example.android.apis/.ApiDemos
info: Waiting for app's activity to become focused
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
info: Getting focused package and activity
error: App never showed up as active. appActivity: .ApiDemos t53 != .ApiDemos
info: [ADB] Sending command to android: {"cmd":"shutdown"}
info: Stopping logcat capture
error: Failed to start an Appium session, err was: Error: App never showed up as active. appActivity: .ApiDemos t53 != .ApiDemos
info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started (Original error: App never showed up as active. appActivity: .ApiDemos t53 != .ApiDemos)","origValue":"App never showed up as active. appActivity: .ApiDemos t53 != .ApiDemos"},"sessionId":"4476394f-c48d-47c7-9916-bca166af3210"}
POST /wd/hub/session 500 28160ms - 333
info: Clearing out appium devices
info: [ANDROID] [info] Got data from client: {"cmd":"shutdown"}
info: [ANDROID] [info] Got command of type SHUTDOWN
info: [ANDROID] [info] Returning result: {"value":"OK, shutting down","status":0}
info: [ANDROID] [info] Closed client connection
info: [ADB STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [ADB STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [ADB STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [ADB STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [ADB STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [ADB STDOUT] INSTRUMENTATION_STATUS: current=1
info: [ADB STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [ADB STDOUT] INSTRUMENTATION_STATUS: stream=
info: [ADB STDOUT] Test results for WatcherResultPrinter=.
info: [ADB STDOUT] Time: 23.179
info: [ADB STDOUT] OK (1 test)
info: [ADB STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [ADB] Received command result from bootstrap
info: Sent shutdown command, waiting for ADB to stop...
error: ADB quit before it successfully launched
info: We're in android's exit callback but adb is gone already


bootstrap online

unread,
Nov 28, 2013, 4:27:44 PM11/28/13
to Johan Lundström, appium-...@googlegroups.com
On Thu, Nov 28, 2013 at 1:03 PM, Johan Lundström
<johan.l...@magine.com> wrote:
> appActivity: .ApiDemos t53 != .ApiDemos"

Your activity name is wrong.

naddy095

unread,
May 8, 2014, 5:52:16 AM5/8/14
to appium-...@googlegroups.com, Johan Lundström
Even I am facing this issue for my level 19 device but the same script works with level 17 device.


"App never showed up as active. appActivity: .activity.common.HomeActivity t15 != .activity.common.HomeActivity"}

bootstrap online

unread,
May 8, 2014, 9:09:51 AM5/8/14
to naddy095, appium-...@googlegroups.com, Johan Lundström
That seems like a bug in appium. We should probably discard whatever
the " t00" is. Please open an issue on GitHub.
> --
> http://appium.io
> ---
> You received this message because you are subscribed to the Google Groups
> "Appium-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to appium-discus...@googlegroups.com.
> Visit this group at http://groups.google.com/group/appium-discuss.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages