general appium Android questions + ruby and mac

749 views
Skip to first unread message

isonic1

unread,
Apr 22, 2013, 1:27:05 PM4/22/13
to appium-...@googlegroups.com
Hey guys - I've hacked around with appium iOS for a while and now I'm playing with android. Have had a couple of issues that I've run into and thought I'd ask here for help/answers. I'd appreciate any help anyone can give on the below questions. Thanks.

1. Send keys command doesn't appear to work. e.g. @driver.find_elements(:tag_name, :textField)[5].send_keys "test" . Getting "NoMethodError: undefined method `send_keys' for []:Array". This works on iOS appium. I can run "@driver.execute_script 'mobile: keyevent', keycode: 31" which will execute a key command. Is this the only way of typing keys for right now?

2. How do I stop appium form timing out? e.g. "info: Didn't get a new command in 60 secs, shutting down...". I'm using ruby irb to debug and setup my test script.

3. Anyone have luck getting google maps "com.google.android.maps" running on target = Android 4.2.2 API 17? My app requires google maps and I want to run the Intel HAX emulator for speed.

4. Is running the appium server via "node server.js" the only way of testing android apps outside of the test example apps? Whenever I run with $ appium I get the below error when running my test script.

$ appium --no-reset -V   (Tried with --fast-reset too.)
info: [ADB] Using adb from /Applications/adt-bundle-mac-x86_64/sdk/platform-tools/adb

info: [ADB] Getting connected devices...
error: Error: Command failed: Android Debug Bridge version 1.0.31

/bin/sh: line 1: devices: command not found

error: uncaughtException date=Mon Apr 22 2013 12:42:32 GMT-0400 (EDT), pid=73614, uid=501, gid=20, cwd=/Users/user/appium, execPath=/usr/local/bin/node, version=v0.10.3, argv=[node, /usr/local/bin/appium, -p9033, --no-reset, -l, --app, /Users/user/appium/sample-code/apps/myapp/bin/myapp-debug.apk, --device-ready-timeout, 60, --app-pkg, com.ridharge.android.myapp, --app-activity, view.SplashActivity, -V], rss=31051776, heapTotal=18635008, heapUsed=11207240, loadavg=[2.28955078125, 1.724609375, 1.880859375], uptime=1281458, trace=[column=18, file=/usr/local/lib/node_modules/appium/uiautomator/adb.js, function=null, line=306, method=null, native=false, column=7, file=/usr/local/lib/node_modules/appium/uiautomator/adb.js, function=, line=466, method=null, native=false, column=7, file=child_process.js, function=ChildProcess.exithandler, line=638, method=exithandler, native=false, column=17, file=events.js, function=ChildProcess.EventEmitter.emit, line=98, method=EventEmitter.emit, native=false, column=16, file=child_process.js, function=maybeClose, line=732, method=null, native=false, column=11, file=child_process.js, function=, line=945, method=null, native=false, column=17, file=events.js, function=Socket.EventEmitter.emit, line=95, method=EventEmitter.emit, native=false, column=12, file=net.js, function=Pipe.close, line=451, method=close, native=false], stack=[TypeError: Cannot read property 'length' of undefined,     at /usr/local/lib/node_modules/appium/uiautomator/adb.js:306:18,     at null.<anonymous> (/usr/local/lib/node_modules/appium/uiautomator/adb.js:466:7),     at ChildProcess.exithandler (child_process.js:638:7),     at ChildProcess.EventEmitter.emit (events.js:98:17),     at maybeClose (child_process.js:732:16),     at Socket.<anonymous> (child_process.js:945:11),     at Socket.EventEmitter.emit (events.js:95:17),     at Pipe.close (net.js:451:12)]



bootstrap online

unread,
Apr 22, 2013, 1:52:18 PM4/22/13
to appium-...@googlegroups.com
On Mon, Apr 22, 2013 at 1:27 PM, isonic1 <justi...@gmail.com> wrote:
1. Send keys command doesn't appear to work. e.g. @driver.find_elements(:tag_name, :textField)[5].send_keys "test" . Getting "NoMethodError: undefined method `send_keys' for []:Array". This works on iOS appium. I can run "@driver.execute_script 'mobile: keyevent', keycode: 31" which will execute a key command. Is this the only way of typing keys for right now?

send_keys works on Android and iOS. Make sure you're using the latest appium from GitHub on the master branch.
 
2. How do I stop appium form timing out? e.g. "info: Didn't get a new command in 60 secs, shutting down...". I'm using ruby irb to debug and setup my test script.

Checkout https://github.com/appium/ruby_console It's better than irb and doesn't timeout. 

4. Is running the appium server via "node server.js" the only way of testing android apps outside of the test example apps? Whenever I run with $ appium I get the below error when running my test script.

node server.js -V --fast-reset is the best way to run appium for Android when running from source.

Satyajit Malugu

unread,
Apr 22, 2013, 4:27:02 PM4/22/13
to appium-...@googlegroups.com
For 5. Are you able to do adb devices on command line without error?

Justin Ison

unread,
Apr 22, 2013, 4:34:01 PM4/22/13
to Satyajit Malugu, appium-...@googlegroups.com
Oh yeah, I can get the device list from the command line. It's only see this error when running appium via $ appium -V but do not get the error with running $ node server.js -V .


--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/OOpjXVicSYc/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jonathan Lipps

unread,
Apr 22, 2013, 7:39:26 PM4/22/13
to Justin Ison, Satyajit Malugu, appium-...@googlegroups.com
Appium installed via npm is currently (and I realized recently has always been) broken for android. Well it's not actually broken per se, just requires building the android bootstrap jar, which you can do by going into the appium npm directory and running "grunt buildAndroidBootstrap". This will be fixed soon.

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.

Jonathan Lipps

unread,
Apr 23, 2013, 5:11:23 PM4/23/13
to isonic1, appium-...@googlegroups.com
This looks like a ruby error of some kind, not an appium error?

isonic1

unread,
Apr 23, 2013, 5:42:45 PM4/23/13
to appium-...@googlegroups.com, isonic1
Yeah, I was trying to interact with the text field like I did with iOS. I ended using bootstraps ruby_console and page method to help debug. This is what I did to get it working. $android.find_element(:xpath, 'textfield[contains(@value, "Email")]').send_keys "test"

Brent LaVelle

unread,
Sep 27, 2013, 12:40:08 AM9/27/13
to appium-...@googlegroups.com, isonic1
This is a ruby error, you are sending the send_keys method to an array.  However, from looking at your code the find_elements is returning an array but you are grabbing the 6th element with the [5]  I would set a breakpoint in the code on this line and evaluate "@driver.find_elements(:tag_name, :textField)" then "@driver.find_elements(:tag_name, :textField)[5]" to see what is going on.  If you don't have a debugger just use a puts.

Whitney Imura

unread,
Oct 23, 2013, 2:36:08 PM10/23/13
to appium-...@googlegroups.com, isonic1
I had to go in and manually change the appium code to avoid this 60 second time out.  

bootstrap online

unread,
Oct 23, 2013, 2:37:42 PM10/23/13
to Whitney Imura, appium-...@googlegroups.com, isonic1
There's a better way.
https://github.com/appium/ruby_lib/blob/afb0b09b54682fd497857a41affcdca531eb6911/lib/appium_lib/driver.rb#L490
> --
> 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.

Whitney Imura

unread,
Oct 23, 2013, 2:40:49 PM10/23/13
to bootstrap online, appium-...@googlegroups.com, isonic1
Ah, that's much better.  Thanks.
--
Reply all
Reply to author
Forward
0 new messages