Coder Social home page Coder Social logo

selendroid / selendroid Goto Github PK

View Code? Open in Web Editor NEW
880.0 122.0 433.0 15.4 MB

"Selenium for Android" (Test automate native or hybrid Android apps and the mobile web with Selendroid.) Join us on IRC #selendroid on freenode. Also confirm you have signed the CLA http://goo.gl/pAvxEI when making a Pull Request.

Home Page: http://selendroid.io

License: Apache License 2.0

Java 73.22% Shell 0.08% JavaScript 24.78% CSS 0.51% HTML 1.27% Ruby 0.14%
selendroid android selenium webdriver end-to-end-testing mobile-development mobile-testing

selendroid's Introduction

Selendroid

Build Status

Selendroid is a test automation framework which drives of the UI of Android native and hybrid applications (apps) and the mobile web with Selendroid. Tests are written using the Selenium 2 client API and for testing the application under test must not be modified.

Selendroid can be used on emulators and real devices and can be integrated as a node into the Selenium Grid for scaling and parallel testing.

You want more details?

Check out our documentation.

Contributing

We have documented Selendroid's Architecture and all the small tricks you need to know when contributing to selendroid you find in our wiki. Also confirm you have signed the CLA when making a Pull Request.

Maven Artifacts

You can find the current version in Maven central.

Building

  1. Run gradle clean build

License

The Apache Software License, Version 2.0

selendroid's People

Contributors

ains avatar antiarchit avatar asm89 avatar blackbaud-kylemartinez avatar bootstraponline avatar bthood avatar chooper9 avatar colindmurray avatar cpaniyadi avatar danielrobertson avatar dominikdary avatar fadinghorse avatar fhoeben avatar iliketonguyen avatar jyang327 avatar koichirok avatar kpiwko avatar lpetre avatar lragnarsson avatar lukeis avatar lukeis-sfdc avatar marcelogomez avatar mkonicek avatar mmn599 avatar o-skor avatar operatiay avatar saral avatar shs96c avatar swapna-chennadi avatar uchida avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

selendroid's Issues

incompatible dependencies between Selendroid and AUT

If the AUT uses guava (and not the same version as selendroid ~ 13.0.1) the android class loader uses the version from selendroid-server apk which causes the AUT to crash when it runs the code that depends on the other version of guava.

Proposed fix: remove references to guava, use standard java (or copy classes into selendroid pacakge) and minimize use of third party libraries that apps could be using.

(temporary fix: I've upgraded my app to use guava 13.0.1 locally, we were using a very old version)

Add back

driver.navigate.back is not supported for native apps.

> driver.navigate.back
post /back
Selenium::WebDriver::Error::UnknownCommandError: The requested command is currently not yet supported by selendroid.

Unable to Start the Selendroid Shell

Unable to launch a Inspector when i run selendroid shell for my activity name .

Had to change the activity name manually in the selendroid-shell.rd file .

Unable to retrieve the tree structure of currently displayed application page

Following error appears in the LogCat when calling http:\localhost:8080\inspector :

05-08 14:04:19.589: W/System.err(1685): org.webbitserver.WebbitException: null on [id: 0xb57deae0, /127.0.0.1:56534 => /127.0.0.1:8080]
05-08 14:04:19.800: W/System.err(1685): at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:136)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:25)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:80)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.handler.PathMatchHandler.handleHttpRequest(PathMatchHandler.java:33)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.handler.DateHeaderHandler.handleHttpRequest(DateHeaderHandler.java:21)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.handler.ServerHeaderHandler.handleHttpRequest(ServerHeaderHandler.java:25)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:67)
05-08 14:04:19.819: W/System.err(1685): at org.webbitserver.netty.NettyHttpChannelHandler$2.run(NettyHttpChannelHandler.java:72)
05-08 14:04:19.819: W/System.err(1685): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
05-08 14:04:19.829: W/System.err(1685): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
05-08 14:04:19.829: W/System.err(1685): at java.lang.Thread.run(Thread.java:856)
05-08 14:04:19.829: W/System.err(1685): Caused by: java.lang.NullPointerException
05-08 14:04:19.829: W/System.err(1685): at org.openqa.selendroid.server.model.DefaultSelendroidDriver.getWindowSource(DefaultSelendroidDriver.java:476)
05-08 14:04:19.829: W/System.err(1685): at org.openqa.selendroid.server.inspector.view.TreeView.render(TreeView.java:37)
05-08 14:04:19.829: W/System.err(1685): at org.openqa.selendroid.server.inspector.InspectorServlet.handleHttpRequest(InspectorServlet.java:47)
05-08 14:04:19.829: W/System.err(1685): at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
05-08 14:04:19.829: W/System.err(1685): ... 14 more
05-08 14:04:28.240: I/System.out(1685): replyWithServerError 500

Having issues with starting the apk

I started a very simple application that I built using 2.3.3 api level to do a POC for our project. There is only main activity in the project. Here is the error when I try to start the apk for application under test:

/Library/Ruby/Gems/1.8/gems/selendroid-0.3.0/lib/selendroid/selendroid_builder.rb:142:in sign_apk': undefined methodhome' for Dir:Class (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/selendroid-0.3.0/lib/selendroid/selendroid_builder.rb:35:in rebuild_selendroid' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/tmpdir.rb:129:inmktmpdir'
from /Library/Ruby/Gems/1.8/gems/selendroid-0.3.0/lib/selendroid/selendroid_builder.rb:17:in rebuild_selendroid' from /Library/Ruby/Gems/1.8/gems/selendroid-0.3.0/lib/selendroid/selendroid_builder.rb:112:inprepare_device'
from /Library/Ruby/Gems/1.8/gems/selendroid-0.3.0/bin/selendroid:89
from /usr/bin/selendroid:19:in `load'
from /usr/bin/selendroid:19

Please state if there is any requirements that I am missing.

Selendroid doesn't launch app

In appium/appium#782, java -jar selendroid-standalone-0.4.0.jar -app THD_E_69140.apk never launches the app.

adb shell am start -n com.thehomedepot/.Foundation.Controller.SetServicesActivity

launches the app. I can't find a value for main activity that works with selendroid though.

adb shell am instrument -e main_activity 'com.thehomedepot.Foundation.Controller.SetServicesActivity' com.thehomedepot.selendroid/io.selendroid.ServerInstrumentation

Selendroid finds the class, however it's never started.

I/System.out( 6434): Instrumentation initialized with main activity: com.thehomedepot.Foundation.Controller.SetServicesActivity

Implicit wait ignored

When finding an element that doesn't yet exist using link text, a NoSuchElementError is immediately returned even though I've set implicit wait.

In Appium, the implicit wait is used to retry the search until either the element is found or the timeout is reached.

appium/appium#525

Find Element by l10n Key

is available in 0.3. but has been removed afterwards from locator find by tag name based on consistency reasons.

Idea: add it to find by xpath

Maven fails with Android SDK 22 updates.

In the Android SDK 22, the platform and build tools are split up into their own items in the SDK manager. You now have to install the build-tools and platform-tools.

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] selendroid ........................................ SUCCESS [0.148s]
[INFO] selendroid-server-common .......................... SUCCESS [1.493s]
[INFO] selendroid-server ................................. FAILURE [0.700s]
[INFO] selendroid-grid-plugin ............................ SKIPPED
[INFO] selendroid-client ................................. SKIPPED
[INFO] selendroid-test-app ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.605s
[INFO] Finished at: Thu May 23 13:46:30 CDT 2013
[INFO] Final Memory: 10M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.2:generate-sources (default-generate-sources) on project selendroid-server: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.2:generate-sources failed: Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <sdk><path>...</path></sdk> in the plugin <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.2:generate-sources (default-generate-sources) on project selendroid-server: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.2:generate-sources failed: Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <sdk><path>...</path></sdk> in the plugin <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.2:generate-sources failed: Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <sdk><path>...</path></sdk> in the plugin <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: com.jayway.maven.plugins.android.InvalidSdkException: Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <sdk><path>...</path></sdk> in the plugin <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME.
    at com.jayway.maven.plugins.android.AndroidSdk.getPathForTool(AndroidSdk.java:196)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:471)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:193)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    ... 20 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :selendroid-server

environment:

ANDROID_HOME=/opt/adt/sdk
JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
PATH=/usr/local/share/npm/bin:/opt/adt/sdk/tools/lib:/opt/adt/sdk/platform-tools:/opt/adt/sdk/build-tools/17.0.0/:/opt/adt/sdk/tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

$ mvn -v

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 07:51:28-0600)
Maven home: /usr/local/Cellar/maven/3.0.5/libexec
Java version: 1.6.0_45, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.3", arch: "x86_64", family: "mac"

$ which aapt
/opt/adt/sdk/build-tools/17.0.0//aapt

typing large amounts of texts fails to send all keys

in my case I'm attempting to send slightly more than 1000 characters to a text box (it has a 1000 char limit to post, but the text box allows you to type them all). but selendroid is stopping typing at around 90 characters. the adb logcat shows:

I/InputDispatcher( 78): Dropped event because it is stale.
W/WindowManager( 78): Input event injection failed.

for every key it doesn't send

(this was against an emulator on api level 14, it happens on other api levels, but I didn't watch the logcat to see if it shows the same thing)

Selendroid: coudn't run on real device

Trying to run selendroid on real device and getting these error, no emulator is in AVD manager.
So if creating the AVD emulator than it is possible only to tun on it.

INFO: executing command: /Applications/adt-bundle-mac-x86_64/sdk/tools/android list avds
Jun 11, 2013 5:02:24 PM io.selendroid.SelendroidLauncher lauchServer
SEVERE: Error occured while building server: null
java.lang.NullPointerException
at java.io.File.(File.java:222)
at io.selendroid.android.impl.DefaultAndroidEmulator.listAvailableAvds(DefaultAndroidEmulator.java:166)
at io.selendroid.server.model.SelendroidStandaloneDriver.initAndroidDevices(SelendroidStandaloneDriver.java:134)
at io.selendroid.server.model.SelendroidStandaloneDriver.(SelendroidStandaloneDriver.java:76)
at io.selendroid.server.SelendroidStandaloneServer.initializeSelendroidServer(SelendroidStandaloneServer.java:83)
at io.selendroid.server.SelendroidStandaloneServer.(SelendroidStandaloneServer.java:58)
at io.selendroid.SelendroidLauncher.lauchServer(SelendroidLauncher.java:41)
at io.selendroid.SelendroidLauncher.main(SelendroidLauncher.java:82)
Jun 11, 2013 5:02:24 PM io.selendroid.SelendroidLauncher$1 run
INFO: Shutting down Selendroid standalone

aapt is not included in the latest version of the Android SDK [Revision 22]

Using first Android device with serial: 42f7460bd5279f41
sh: /Android/sdk/platform-tools/aapt: No such file or directory
/Users/scb/.rvm/gems/ruby-2.0.0-p0/gems/selendroid-0.3.1/lib/selendroid/selendroid_builder.rb:57:in get_app_base_package': undefined method[]' for nil:NilClass (NoMethodError)
from /Users/scb/.rvm/gems/ruby-2.0.0-p0/gems/selendroid-0.3.1/lib/selendroid/selendroid_builder.rb:8:in rebuild_selendroid' from /Users/scb/.rvm/gems/ruby-2.0.0-p0/gems/selendroid-0.3.1/lib/selendroid/selendroid_builder.rb:112:inprepare_device'
from /Users/scb/.rvm/gems/ruby-2.0.0-p0/gems/selendroid-0.3.1/bin/selendroid:89:in <top (required)>' from /Users/scb/.rvm/gems/ruby-2.0.0-p0/bin/selendroid:23:inload'
from /Users/scb/.rvm/gems/ruby-2.0.0-p0/bin/selendroid:23:in <main>' from /Users/scb/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:ineval'
from /Users/scb/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `

'

Error starting application under test

with regards to the following issue:

https://github.com/DominikDary/selendroid/issues/23

I have a new error showing up while the app is starting:

2013-05-03 14:50:01 - Using first Android device with serial: emulator-5554
2013-05-03 14:50:02 - Building selendroid-server for package com.example.test
2013-05-03 14:50:02 - Done signing the test server. Moved it to selendroid-server-0.3.1.apk
3671 KB/s (907639 bytes in 0.241s)
2013-05-03 14:50:04 - The selendroid server has been rebuild and installed on the device.
3992 KB/s (194881 bytes in 0.047s)
2013-05-03 14:50:08 - The app has been resigned test-debug.apk and installed on the device.
2013-05-03 14:50:08 - Starting selendroid-server with main activity: com.example.test.HomeActivity

/Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/protocol.rb:135:in read_nonblock': end of file reached (EOFError) from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/protocol.rb:135:inrbuf_fill'
from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/protocol.rb:116:in readuntil' from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/protocol.rb:126:inreadline'
from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:2219:in read_status_line' from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:2208:inread_new'
from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:1191:in transport_request' from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:1177:inrequest'
from /Users/user1/.rvm/gems/ruby-1.9.2-p320/gems/selendroid-0.3.1/lib/selendroid/selendroid_driver.rb:98:in block (2 levels) in wait_for_selendroid_server' from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:627:instart'
from /Users/user1/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:490:in start' from /Users/user1/.rvm/gems/ruby-1.9.2-p320/gems/selendroid-0.3.1/lib/selendroid/selendroid_driver.rb:97:inblock in wait_for_selendroid_server'
from /Users/user1/.rvm/gems/ruby-1.9.2-p320/gems/retriable-1.3.3/lib/retriable/retriable.rb:31:in perform' from /Users/user1/.rvm/gems/ruby-1.9.2-p320/gems/retriable-1.3.3/lib/retriable/retriable.rb:50:inretriable'
from /Users/user1/.rvm/gems/ruby-1.9.2-p320/gems/selendroid-0.3.1/lib/selendroid/selendroid_driver.rb:93:in wait_for_selendroid_server' from /Users/user1/.rvm/gems/ruby-1.9.2-p320/gems/selendroid-0.3.1/bin/selendroid:92:in<top (required)>'
from /Users/user1/.rvm/gems/ruby-1.9.2-p320/bin/selendroid:19:in load' from /Users/user1/.rvm/gems/ruby-1.9.2-p320/bin/selendroid:19:in

'
from /Users/user1/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in eval' from /Users/user1/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in'

Unable to select an option from dropdown in webview

I am testing an android hybrid app but unable to select an option from the dropdown list in a webview .
It doesn't throw any error but when I click on the option WebElement it doesn't get selected.
I tried to get it working with 'Select' but gives an unsupported message back.
Please find the jave code below which tries to choose an option from a drop down list.

List listOfOptions = element.findElements(By.tagName("option"));
Iterator elementsFound = listOfOptions.iterator();
while (elementsFound.hasNext()) {
WebElement currentOption = elementsFound.next();
// Check if the option value matches the value you're
// looking for
if (match the value) {
currentOption.click();
break;
}
}
I could see that the 'currentOption' has the value which I intend to set but 'click' on it doesn't seem to be working.

Swapna.

Error when trying to start standalone server with APK

A 'Severe' error occurs when the standalone server tries to resign the APK file. No details of the error are displayed. The output is attached below.

I've verified that the ANDROID_HOME environment variable is set.

Jun 5, 2013 11:09:46 AM io.selendroid.SelendroidLauncher main
INFO: ################# Selendroid #################
Jun 5, 2013 11:09:46 AM io.selendroid.SelendroidLauncher lauchSelendroid
INFO: Starting selendroid-server port 5555
Jun 5, 2013 11:09:46 AM io.selendroid.io.ShellCommand exec
INFO: executing command: /usr/libexec/java_home -v 1.7/bin/jarsigner -sigalg MD5withRSA -digestalg SHA1 -signedjar /Users/scb/Downloads/resigned-HelloWorld.apk -storepass android -keystore /Users/scb/.android/debug.keystore /Users/scb/Downloads/HelloWorld.apk androiddebugkey
Jun 5, 2013 11:09:46 AM io.selendroid.SelendroidLauncher lauchSelendroid
SEVERE: Error occured while building server: An error occured while resigning the app 'HelloWorld.apk'.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.3', java.version: '1.6.0_45'
Driver info: driver.version: SelendroidStandaloneDriver

An error occurred while resigning the app

can anyone help on the below error?

C:\Users\cmc8245\workspace\AppiumPOCAndroid>java -jar selendroid-standalone-0.4.
0.jar -app THD_E_69140.apk
Jun 17, 2013 11:09:36 AM io.selendroid.SelendroidLauncher main
INFO: ################# Selendroid #################
Jun 17, 2013 11:09:36 AM io.selendroid.SelendroidLauncher lauchServer
INFO: Starting selendroid-server port 5555
Jun 17, 2013 11:09:36 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/MANIFEST.MF
Jun 17, 2013 11:09:36 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/CERT.RSA
Jun 17, 2013 11:09:36 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/CERT.SF
Jun 17, 2013 11:09:36 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/ANDROIDD.SF
Jun 17, 2013 11:09:37 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/ANDROIDD.RSA
Jun 17, 2013 11:09:37 AM io.selendroid.SelendroidLauncher lauchServer
SEVERE: Error occured while building server: An error occured while resigning th
e app 'THD_E_69140.apk'.
io.selendroid.exceptions.SessionNotCreatedException: An error occured while resi
gning the app 'THD_E_69140.apk'.
at io.selendroid.server.model.SelendroidStandaloneDriver.initApplication
sUnderTest(SelendroidStandaloneDriver.java:102)
at io.selendroid.server.model.SelendroidStandaloneDriver.(Selendro
idStandaloneDriver.java:75)
at io.selendroid.server.SelendroidStandaloneServer.initializeSelendroidS
erver(SelendroidStandaloneServer.java:83)
at io.selendroid.server.SelendroidStandaloneServer.(SelendroidStan
daloneServer.java:58)
at io.selendroid.SelendroidLauncher.lauchServer(SelendroidLauncher.java:
41)
at io.selendroid.SelendroidLauncher.main(SelendroidLauncher.java:82)
Caused by: io.selendroid.exceptions.ShellCommandException: An error occured whil
e executing shell command: C:\Program Files\Java\jre6\bin\jarsigner.exe -sigalg
MD5withRSA -digestalg SHA1 -signedjar C:\Users\cmc8245\workspace\AppiumPOCAndroi
d\resigned-THD_E_69140.apk -storepass android -keystore C:\Users\cmc8245.androi
d\debug.keystore C:\Users\cmc8245\workspace\AppiumPOCAndroid\THD_E_69140.apk and
roiddebugkey
at io.selendroid.io.ShellCommand.exec(ShellCommand.java:51)
at io.selendroid.builder.SelendroidServerBuilder.signTestServer(Selendro
idServerBuilder.java:249)
at io.selendroid.builder.SelendroidServerBuilder.resignApp(SelendroidSer
verBuilder.java:124)
at io.selendroid.server.model.SelendroidStandaloneDriver.initApplication
sUnderTest(SelendroidStandaloneDriver.java:100)
... 5 more
Caused by: io.selendroid.exceptions.ShellCommandException:
... 9 more
Jun 17, 2013 11:09:37 AM io.selendroid.SelendroidLauncher$1 run
INFO: Shutting down Selendroid standalone

C:\Users\cmc8245\workspace\AppiumPOCAndroid>

SelendroidNativeDriver.getWindowSource() returns only decorView

http://localhost:8080/wd/hub/session/e3a6b6f1-46db-46a9-bb2c-9ea354e3a124/source
is returning only the root element and not the children:
{"sessionId":"e3a6b6f1-46db-46a9-bb2c-9ea354e3a124","status":0,"value":{"l10n":{"matches":0},"label":"null","name":"android:id/content","rect":{"origin":{"x":0,"y":50},"size":{"height":430,"width":320}},"ref":16908290,"type":"FrameLayout","value":null,"activity":"{org.openqa.selendroid.testapp/org.openqa.selendroid.testapp.HomeScreenActivity}"}}

Add Selendroid-standalone support for windows

Currently selendroid-standalone is not offially supported for windows.
There are several reason for this:

  • the Android executable has a bat suffix (not .exe)
  • the command execution works only, if the path to the executable contains no spaces.
  • killing the emulator has now effect on windows

Set implicit wait does not work reliable

The end point for setting the implicit wait is implemented and assigns the new value to the AndroidWait instance in the ServerInstrumentation.
But when searching for elements, where the search is taking a bit longer, it seem not to work reliable.
Maybe: /session/:sessionId/timeouts must be implemented as well.

Workaround: use in the test the WebDriverWait.

Include visibility attribute in source output

Source doesn't currently include a visibility attribute. I tried this however it doesn't work.

diff --git a/selendroid-server/src/main/java/org/openqa/selendroid/server/model/AndroidNativeElement.java b/selendroid-s
index fc0c205..654ea1b 100644
--- a/selendroid-server/src/main/java/org/openqa/selendroid/server/model/AndroidNativeElement.java
+++ b/selendroid-server/src/main/java/org/openqa/selendroid/server/model/AndroidNativeElement.java
@@ -291,7 +291,10 @@ public class AndroidNativeElement implements AndroidElement {
       value = String.valueOf(((TextView) view).getText());
     }
     object.put("value", value);
-
+    if (view instanceof AndroidElement) {
+      object.put("displayed", ((AndroidElement) view).isDisplayed());
+      object.put("shown", view.isShown());
+    }
     return object;
   }

Standalone-server failt to open URL

opening an url via server-standalone is running into a timeout, running it against the selendrid server on the device itself it is working fine:

    String activityClass = "io.selendroid.testapp." + "HomeScreenActivity";
    driver.get("and-activity://" + activityClass);

Should execute android.bat instead of android.exe

Jun 05, 2013 10:26:12 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\android-sdk\tools\android.exe list avds
Jun 05, 2013 10:26:12 AM io.selendroid.SelendroidLauncher lauchSelendroid
SEVERE: Error occured while building server: io.selendroid.exceptions.ShellCommandException: An error occured while executing shell command: C:\android-sdk\tools\android.exe list avds

C:\Users*****\Desktop\Workspace\selendroid-master>android list avds
'android' is not recognized as an internal or external command,
operable program or batch file.

C:\Users*****\Desktop\Workspace\selendroid-master>android list avd
'android' is not recognized as an internal or external command,
operable program or batch file.

C:\Users*****\Desktop\Workspace\selendroid-master>C:\android-sdk\tools\android.exe list avds
'C:\android-sdk\tools\android.exe' is not recognized as an internal or external
command,
operable program or batch file.

Correct Command on Windows 7 64 bit:

C:\Users****\Desktop\Workspace\selendroid-master>C:\android-sdk\tools\android
.bat list avds
Available Android Virtual Devices:
Name: Android_2.3.3
Path: C:\Users**
**.android\avd\Android_2.3.3.avd
Target: Android 2.3.3 (API level 10)
ABI: armeabi

Skin: WVGA800

Name: Android_4.1.2
Path: C:\Users\*****\.android\avd\Android_4.1.2.avd

Target: Android 4.1.2 (API level 16)
ABI: x86
Skin: WVGA800
Sdcard: 16M

Add a wait before starting the selendroid client

When entering the selendroid shell in the beginning the selendroid server will be started.
Currently immediately the client will be started wich causes an error if the start of the app takes a bit longer.

Fix: add a wait until the server is started and then start the client.

selendroid logging?

Hi @DominikDary, I'm getting selendroid integration going in Appium, and I'm running into 500 response codes when trying to start new sessions. Is there any logging in selendroid so I can see what's happening? I'm getting a pure 500, no body or anything else in the response.

Also, are there restrictions or suggestions on what kind of desired caps to pass to selendroid?

Selendroid-standalone has a class cast exception

INFO: Payload? {"using":"id","value":"my_text_field"} Jun 04, 2013 2:47:57 PM io.selendroid.server.handler.RequestRedirectHandler hand le INFO: return value from selendroid android server: {"message":"Element was not f ound.","class":"io.selendroid.exceptions.NoSuchElementException","stacktrace":[" io.selendroid.server.handler.FindElement.handle(FindElement.java:56)","io.selend roid.server.AndroidServlet.handleRequest(AndroidSer

io.selendroid.server.handler.RequestRedirectHandler hand le INFO: return status from selendroid android server: 7 Jun 04, 2013 2:47:57 PM io.selendroid.server.SelendroidServlet handleRequest SEVERE: Error occured while handlinf request: java.lang.ClassCastException: org. json.JSONObject cannot be cast to java.lang.String

StaleElementReferenceException , when capturing screenshot

StaleElementReferenceException is been triggered when capturing a screenshot before the webelement action is completed.

For example :

Throws exception for the below code.
WebElement button = driver.findElement(By.id("buttonStartWebview"));
takeScreenShot("Main Activity started.");
button.click();

Works fine for the below code:

WebElement button = driver.findElement(By.id("buttonStartWebview"));
button.click();
takeScreenShot("Main Activity started.");

Selendroid does not recognize multiple webviews

In an application with multiple webviews, only the first one is accessed using driver.switchTo():
driver.switchTo().window("WEBVIEW");

When I list the windows, I only get two options:
System.out.print(driver.getWindowHandles().toString());
[WEBVIEW, NATIVE_APP]

Perhaps it additional webviews (ex: WEBVIEW_2, WEBVIEW_3) could be added to the windowHandles when they are present

driver.switchTo.window() method won't work when I switch "WEBVIEW" to "NATIVE_APP" repeatedly

When i test hybrid app, i find element at webview, then i switch to "NATIVE_APP".
And find element at native app, then again i switch to "WEBVIEW"
Then i find same element at webview.

But i got this stack trace(it seems like timeout exception)

org.openqa.selenium.WebDriverException:
Command duration or timeout: 60.06 seconds
Build info: version: '2.32.0', revision: '6c40c187d01409a5dc3b7f8251859150c8af0bcb', time: '2013-04-09 10:39:28'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_30'
Session ID: 1f3251c8-ad4a-4d84-9506-8b5958c87465
Driver info: org.openqa.selendroid.SelendroidDriver
Capabilities [{platform=ANDROID, javascriptEnabled=true, acceptSslCerts=true, browserName=selendroid, handlesAlerts=false, rotatable=false, takesScreenshot=true, version=0.4-SNAPSHOT}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.getLocation(RemoteWebElement.java:331)
at org.openqa.selendroid.NaverAppTestSuite.testNaverHome(NaverAppTestSuite.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


this is my test code
for(int i=0;i<10;i++){
driver.switchTo().window("WEBVIEW");
System.out.println(driver.getWindowHandle());
System.out.println(driver.findElementByXPath("//h1[@Class='u_vc']").getLocation());
driver.switchTo().window("NATIVE_APP");
System.out.println(driver.getWindowHandle());
System.out.println(driver.findElementById("search_window_edit").getLocation());
}

stale element reference error is not thrown in native context

Expected behavior:
When interacting with native elements an element command must fail if the referenced element is no longer attached to the DOM/screen.

current behavior:
The StaleElementException is generally used but in the KnownElements Cache there is no validation if the element is still displayed.

SendKeys handler JSONArray issue

The handler just takes the text from payload and does not handle it as JSONArray.
In the SendKeyToActiveElement it is already b done in the right way.

SelendroidLauncher getting hanged

Hi
SelendroidLauncher getting hanged like below,,

C:\Users\cmc8245\workspace\AppiumPOCAndroid>java -jar selendroid-standalone-0.4.
0.jar -app THD_E_69140.apk
Jun 17, 2013 11:16:05 PM io.selendroid.SelendroidLauncher main
INFO: ################# Selendroid #################
Jun 17, 2013 11:16:06 PM io.selendroid.SelendroidLauncher lauchServer
INFO: Starting selendroid-server port 5555
Jun 17, 2013 11:16:06 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/MANIFEST.MF
Jun 17, 2013 11:16:06 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/CERT.RSA
Jun 17, 2013 11:16:06 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/CERT.SF
Jun 17, 2013 11:16:06 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/ANDROIDD.SF
Jun 17, 2013 11:16:06 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe remove C:\Users\cmc8245\work
space\AppiumPOCAndroid\THD_E_69140.apk META-INF/ANDROIDD.RSA
Jun 17, 2013 11:16:07 PM io.selendroid.builder.SelendroidServerBuilder signTestS
erver
INFO: App signing output:
Jun 17, 2013 11:16:07 PM io.selendroid.builder.SelendroidServerBuilder signTestS
erver
INFO: The app has been signed: C:\Users\cmc8245\workspace\AppiumPOCAndroid\resig
ned-THD_E_69140.apk
Jun 17, 2013 11:16:07 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe dump badging C:\Users\cmc824
5\workspace\AppiumPOCAndroid\resigned-THD_E_69140.apk
Jun 17, 2013 11:16:07 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\aapt.exe dump badging C:\Users\cmc824
5\workspace\AppiumPOCAndroid\resigned-THD_E_69140.apk
Jun 17, 2013 11:16:07 PM io.selendroid.server.model.SelendroidStandaloneDriver i
nitApplicationsUnderTest
INFO: App com.thehomedepot:1.0 has been added to selendroid standalone server.
Jun 17, 2013 11:16:07 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\adb.exe kill-server
Jun 17, 2013 11:16:08 PM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\cmc8245\Downloads\adt-bundle-windows-x86_64\ad
t-bundle-windows-x86_64\sdk\platform-tools\adb.exe start-server

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.