Giter Club home page Giter Club logo

appium-adb's Introduction

appium-adb

NPM version Downloads

A wrapper over Android Debugger Bridge, implemented using ES6 and along with async/await. This package is mainly used by Appium to perform all adb operations on Android devices.

Installing

npm install appium-adb

Watch

npm run dev

Test

unit tests

npm run test

functional tests

By default the functional tests use an avd named NEXUS_S_18_X86, with API Level 18. To change this, you can use the environment variables PLATFORM_VERSION, API_LEVEL, and ANDROID_AVD. If PLATFORM_VERSION is set then it is not necessary to set API_LEVEL as it will be inferred.

npm run e2e-test

Usage:

example:

import ADB from 'appium-adb';

const adb = await ADB.createADB();
console.log(await adb.getPIDsByName('com.android.phone'));

appium-adb's People

Contributors

austenke avatar boneskull avatar bootstraponline avatar dependabot-preview[bot] avatar dependabot[bot] avatar dpgraham avatar gleemitsu avatar greenkeeper[bot] avatar hexxeh avatar imurchie avatar jlipps avatar jonahss avatar kazucocoa avatar lbielski avatar mhan83 avatar moizjv avatar mykola-mokhnach avatar notwoods avatar nozomiito avatar rerorero avatar rgonalo avatar scottdixon avatar sebv avatar semantic-release-bot avatar sravanmedarapu avatar sshock avatar vikki avatar vmaxim avatar vrunoa avatar whirosan 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

appium-adb's Issues

Usage documentation

It will be great a little bit of documentation how to use in other projects. I saw the TODO but this is only a reminder :) I'm trying to use it.

Getting Process Ids does'nt work for some devices

Problem:

We are trying to get pid of our application , during our test steps however for some Android devices however, we can't get any pid. We managed to find out that "ps" command doesn't work for every Android device.
For Alcatel(TCL) 5052Y "ps" output;

$ ../ANDROID_HOME/platform-tools/adb -s YT55KVQGB64HQGMB shell
A3A:/ $ ps
USER           PID  PPID     VSZ    RSS WCHAN            ADDR S NAME
shell        21989 32761    4952   2532 sigsuspend   b2f1d778 S sh
shell        21992 21989    5568   3016 0            b4396448 R ps
A3A:/ $ getprop ro.product.model
5052Y
A3A:/ $ getprop ro.product.brand
TCL
A3A:/ $
**And "ps -ef" output:**
A3A:/ $ ps -ef
UID            PID  PPID C STIME TTY          TIME CMD
root             1     0 0 10:51:53 ?     00:00:17 init
root             2     0 0 10:51:53 ?     00:00:00 [kthreadd]
root             3     2 0 10:51:53 ?     00:00:08 [ksoftirqd/0]
root             5     2 0 10:51:53 ?     00:00:00 [kworker/0:0H]
root             7     2 0 10:51:53 ?     00:14:14 [rcu_preempt]
root             8     2 0 10:51:53 ?     00:00:10 [rcu_sched]

Our solution:

However we find out that , using "ps -ef" isn't the sollution because this command doesn't work for every Android device either. So we found another solution which is using ;
"for p in /proc/[0-9]*; do [[ $(<$p/cmdline) = " + name + " ]] && echo ${p##*/}; done" to get pids.

targetSdkVersionFromManifest fails if apk does not include targetSdkVersion

Steps to reproduce:

copy settings_apk-debug.apk from io.appium.settings to test/fixtures/settings_apk-debug.apk

change the following in android-manifest-e2e-specs.js:

-                                'selendroid', 'selendroid.apk');
+                                'selendroid', 'selendroid.apk'),
+      settingsApp = path.resolve(rootDir, 'test', 'fixtures', 'settings_apk-debug.apk');

add this to the 'Android-manifest' spec:

it('targetSdkVersionFromManifest works on our own settingsApp', async () => {
let version = adb.targetSdkVersionFromManifest(settingsApp);
});

Issues with ADB after installing appium-adb lib

Environment:
Mac OSX: 10.10.5
RubyMine: 8.0.3
Appium: 1.4.7

Issue:
I recently install the appium-adb lib to get access to extra ADB-related methods:

npm install appium-adb

Then when I debug the ruby tests (RSpec) I found that debugger get lost and can not connect to the process. When I run tests it take much time than when I run them without this lib.

Then I also noticed that when I re-start the ADB server:

thq-m-sdubo01:tiara sdubov$ adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
adb I  1721 33954 usb_osx.cpp:259] Found vid=04e8 pid=6860 serial=01157df152cca62b
adb I  1721 33954 usb_osx.cpp:259]
* daemon started successfully *
01157df152cca62b    device

I get two extra lines:

adb I  1721 33954 usb_osx.cpp:259] Found vid=04e8 pid=6860 serial=01157df152cca62b
adb I  1721 33954 usb_osx.cpp:259]

that points me to the usb_osx.cpp.
So, I have an assumption that debugger just look for a different device and can not attach to a right one.

Tried solutions:

  • Reinstall Android SDK - did not fix
  • Reinstall RubyMine - did not fix
  • After updating to the newly Android version through SDK, the issue is gone, but then when I re-install the appium-adb it appears again.

Guys, do you have any ideas how can I fix it?

Function extention (apk-utils - isAppInstalled) with the ability to indicate user profile id

HI, I would like to ask for the possibility of providing a specific profile ID to the isAppInstalled function from the caps settings level if there is more than one profile on the device, especially if one of these profiles has restrictions imposed (e.g. in connection with the company profile).

The call (https://github.com/appium/appium-adb/blob/master/lib/tools/apk-utils.js#L51) should be expanded by "--user userId" where userId is passing from caps options.

Currently, in the example given, it causes the following error

list packages' exited with code 255'; Command output: [AppiumDriver@9141] Exception occurred while executing 'list': [AppiumDriver@9141] java.lang.SecurityException: Shell does not have permission to access user 10 [AppiumDriver@9141] com.android.server.am.ActivityManagerService.handleIncomingUser:15872 android.app.ActivityManager.handleIncomingUser:5132 com.android.server.pm.PackageManagerShellCommand.translateUserId:3733 [AppiumDriver@9141] at com.android.server.am.UserController.handleIncomingUser(UserController.java:2892) [AppiumDriver@9141] at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:15872) [AppiumDriver@9141] at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:5132) [AppiumDriver@9141] at com.android.server.pm.PackageManagerShellCommand.translateUserId(PackageManagerShellCommand.java:3733)

Parsing of "intentOptionalArgs" with a value contening ' - '

Hello, with - character in optional intent args it might have a parsing problem :

shell
[HTTP] --> POST /wd/hub/session/618433d1-fd70-4ad6-bfc2-75294d8e684d/appium/device/start_activity {"appPackage":"android","appActivity":"com.android.internal.app.ResolverActivity","appWaitPackage":"","appWaitActivity":"","dontStopAppOnReset".intent.action.VIEW","intentCategory":"android.intent.category.BROWSABLE","intentFlags":"","optionalIntentArguments":"-d 'https://www2.qa0.bon-coin.net/vi/1070547.htm'"}


Then :

``` shell```
[debug] [ADB] Running /home/fanch/Downloads/android-sdk-linux/platform-tools/adb with args: ["-P",5037,"-s","ENU7N15B14002933","shell","am","start","-n","android/com.android.internal.app.ResolverActivity","-S","-a","android.intent.action.VIE {...} ry.BROWSABLE","-d","'https://www2.qa0.bon"]

We can see the url stops at the -.

adb equivalent working :

shell
adb -s $1 shell "am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d https://www2.qa0.bon-coin.net/vi/1070547.htm"


I guess there is a check with the `-` character for other optional intent arguments, need to ignore it in values (Same using 'url' or url, it isn't a quote issue). 

By the way appActivity and appPackage are not necessary to open a deep link, what about add a 

> startIntent(String intentAction,String intentCategory,
> String intentFlags,String intentOptionalArgs)

method in java-client?

Add methods to get and set the battery details

How much control we want to give is up in the air.

Getting the status:

👻 ➤ adb shell dumpsys battery
Current Battery Service state:
  AC powered: true
  USB powered: false
  Wireless powered: false
  status: 2
  health: 2
  present: true
  level: 89
  scale: 100
  voltage: 0
  temperature: 0
  technology: Li-ion

Setting the status:

👻 ➤ adb shell dumpsys battery set
Dump current battery state, or:
  set ac | usb | wireless | status | level | invalid <value>

APK install timeout is hardcoded

Hi,

Despite setting --launch-timeout to a very high value, I kept having a timeout of 60000ms. I have to change it directly in the code to fix it:

apkUtilsMethods.install = async function (apk, replace = true, timeout = 60000) {

I'm not sure the issue is in appium-adb itself, but it seems that the command-line timeout parameters have not much influence on the actual timeouts.

thanks!

"Selendroid needs internet permission to proceed" error while running tests using the selendroid automationName

I'm running my test on Android 4.1 device using Selendroid as automationName (Appium 1.2.3, OSX 10.10) and getting following permission error:

error: Could not pre-launch appium: Error: apk does not have INTERNET permissions. Selendroid needs internet permission to proceed, please check if you have <uses-permission android:name="android.**permission.INTERNET"/> in your AndroidManifest.xml

This answer https://discuss.appium.io/t/setting-up-android-environment-with-selendroid/931/12?u=aki from the Appium Discuss solved my issue.

Using "optionalIntentArguments" to pass a JSON string argument to an activity fails due to quoting issues through 2 levels of shells (host -> Android)

Hi,

I was trying to pass a JSON string to an Android activity using the "optionalIntentArguments" capabilities and was puzzled by the fact that only the first JSON parameter would end up in the activity intent extras.

# This is Python code
optionalIntentArguments = '-e user \'"\'{"username":"selenium","administrator":true,"objectId":"1","email":""}\'"\''

which ends up in the appium log as:

info: [debug] executing cmd: /home/jbl/adt/sdk/platform-tools/adb -s LGDXXXX shell am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n xx.xx.xx/xx.xx.xx.Activity -e user '"'{"username":"selenium","administrator":true,"objectId":"1","mobileUpdatedAt":"2015-07-03T09:31:08.194Z","hide_customers":false,"fullName":"selenium","email":""}'"'

This looks fine, but the extras getString("user") returns "username":"selenium" which is wrong...

I immediately suspected quoting and tried various combinations of backslashes, single vs double quotes and couldn't for the life of me figure it out.

I got to a point where this worked when issuing the "am start" command from the ADB shell, but not from my computer's shell (which is similar to the appium scenario).

I searched around and found this, which put me on the right track to solve my issue:

See http://stackoverflow.com/a/29428061/1872442

I modified the _buildStartCmd function in https://github.com/appium/appium-adb/blob/master/lib/adb.js
to quote the entire adb command:

adb -s LGDXXXX shell am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n xx.xx.xx/xx.xx.xx.Activity -e user '"'{"username":"selenium","administrator":true,"objectId":"1","email":""}'"'

becomes:

adb -s LGDXXXX shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n xx.xx.xx/xx.xx.xx.Activity -e user '"'{"username":"selenium","administrator":true,"objectId":"1","email":""}'"'"

which works fine and doesn't seem to cause any other issue.

I'm currently working on a pull request for this...

Cheers,

JB

Installing appium-adb via npm install fails with "Error: shasum check failed"

Hey. Thanks for all the work! I was trying to update appium on my OS X mavericks machine via npm install -g appium when I ran into this issue when it tried to install appium-adb. I tried to install appium-adb specifically and got it again:

bash-3.2$ npm install -g -f appium-adb
npm WARN using --force I sure hope you know what you are doing.
npm http GET https://registry.npmjs.org/appium-adb
npm http 304 https://registry.npmjs.org/appium-adb
npm http GET https://registry.npmjs.org/appium-adb/-/appium-adb-1.3.3.tgz
npm http 200 https://registry.npmjs.org/appium-adb/-/appium-adb-1.3.3.tgz
npm ERR! Error: shasum check failed for /tmp/npm-53516-I_1GCNrY/1406323446268-0.7710538334213197/tmp.tgz
npm ERR! Expected: b5a25be7ded4a816ddbe52db58f9b00c41142932
npm ERR! Actual:   f2c8793d65e717f51286a23c267a27200b80633d
npm ERR! From:     https://registry.npmjs.org/appium-adb/-/appium-adb-1.3.3.tgz
npm ERR!     at /usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/sha/index.js:38:8
npm ERR!     at ReadStream.<anonymous> (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/sha/index.js:85:7)
npm ERR!     at ReadStream.EventEmitter.emit (events.js:117:20)
npm ERR!     at _stream_readable.js:920:16
npm ERR!     at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Darwin 13.3.0
npm ERR! command "/usr/local/Cellar/node/0.10.26/bin/node" "/usr/local/bin/npm" "install" "-g" "-f" "appium-adb"
npm ERR! cwd /Users/dgempesaw/opt/appium
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/dgempesaw/opt/appium/npm-debug.log
npm ERR! not ok code 0

verbose log mentioned in npm-debug.log: https://gist.github.com/anonymous/1c2efd05f4c9cdf5f311

things I tried to fix it that didn't work:

  • clean npm's cache: $ npm cache clean
  • update node version from 0.10.26 to 0.10.28 $ brew upgrade node

Happily, installing directly from the tgz works:

$ npm install -g https://registry.npmjs.org/appium-adb/-/appium-adb-1.3.3.tgz
$ npm install -g appium

Just wanted to point it out in case other people are seeing it. Feel free to close if no one can reproduce. Thanks!

Consider using adbkit for some functionality

Hi,

Just happened to notice appium-adb by chance by following deps on NPM, hope you don't mind. Not sure what the best way to provide suggestions/feedback would be, but you guys might be interested in https://github.com/CyberAgent/adbkit. It should make some things way easier for you, although it currently doesn't support everything you're doing (pull requests and feedback welcome). Sorry for the plug but it might be worthwhile to give it a go :)

Can it add display option to startApp ?

Warning:

These issues are not tracked. Please create new issues in the main Appium
repository: https://github.com/appium/appium/issues/new
Our android device have two more display which we can launch on different display. commands looks like below:
adb -P 5037 -s 10.13.100.18\:5555 shell am start -W -n pkg/.act -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 --display 1
So we can use this parameter on appium-uiautomator2 to start on another display.

Can no longer connect to Android Emulator with Android SDK Tools 25.1.1

Just got appium up and running yesterday on an Android project. Updated the tools this morning (and nothing else), then noticed that appium started raising errors when attempting to talk to the android emulator.

Behavior: When appium driver is started, the configured AVD emulator will start, but then appium will fail to communicate with it and raise an exception. On a second run, it will fail to see the running emulator and start another instance, then fail again for the same issue.

Full appium log: https://gist.github.com/garyjohnson/7690fa79a1aeb1ee9f26cbb5082d8868

Details: appium-adb appears to fail specifically when running avd name over telnet connection. One thing I noticed is that it looks like there is loopback data on the telnet connection (i.e., you can see "avd name" returned in the telnet data along with the emulator name), but unsure if this is how it behaved previously:

[debug] [ADB] Sending telnet command to device: avd name
[debug] [ADB] Getting running emulator port
[debug] [ADB] Socket connection to device created
[debug] [ADB] Socket connection to device ready
[debug] [ADB] Telnet command got response: a�[K�[Dav�[K�[D�[Davd�[K�[D�[D�[Davd �[K�[D�[D�[D�[Davd n�[K�[D�[D�[D�[D�[Davd na�[K�[D�[D�[D�[D�[D�[Davd nam�[K�[D�[D�[D�[D�[D�[D�[Davd name�[K
Testing
[debug] [ADB] Emulator Testing not running

Running Appium 1.5.1, NPM 3.3.12, OSX El Capitan 10.11.4, Node 5.4.0, Android SDK Tools 25.1.1, Android SDK Build-Tools 23.0.2

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Simplify searching for Android SDK binary locations.

Currently we support 2 ways of searching for binaries: one with ANDROID_HOME and one without. Since we already document ANDROID_HOME as required for setup, we should reduce our complexity and remove the non-A_H code.

So

if (this.sdkRoot) {
    var binaryLocs = [ path.resolve(this.sdkRoot, "platform-tools", binaryName)
      , path.resolve(this.sdkRoot, "tools", binaryName) ];
    // get subpaths for currently installed build tool directories
    var buildToolDirs = getDirectories(path.resolve(this.sdkRoot, "build-tools"));

    _.each(buildToolDirs, function (versionDir) {
      binaryLocs.push(path.resolve(this.sdkRoot, "build-tools", versionDir, binaryName));
    }.bind(this));

    _.each(binaryLocs, function (loc) {
      if (fs.existsSync(loc)) binaryLoc = loc;
    });

    if (binaryLoc === null) {
      cb(new Error("Could not find " + binary + " in tools, platform-tools, " +
                   "or supported build-tools under \"" + this.sdkRoot + "\"; " +
                   "do you have the Android SDK installed at this location?"));
      return;
    }
    logger.debug("Using " + binary + " from " + binaryLoc);
    binaryLoc = '"' + binaryLoc.trim() + '"';
    this.binaries[binary] = binaryLoc;
    cb(null, binaryLoc);
  } else {
    logger.warn("The ANDROID_HOME environment variable is not set to the Android SDK root directory path. " +
                "ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for " + binary + ".");
    exec(cmd + " " + binary, { maxBuffer: 524288 }, function (err, stdout) {
      if (stdout) {
        logger.debug("Using " + binary + " from " + stdout);
        this.binaries[binary] = '"' + stdout.trim() + '"';
        cb(null, this.binaries[binary]);
      } else {
        cb(new Error("Could not find " + binary + ". Please set the ANDROID_HOME " +
                     "environment variable with the Android SDK root directory path."));
      }
    }.bind(this));
  }

Would become

if (this.sdkRoot) {
    var binaryLocs = [ path.resolve(this.sdkRoot, "platform-tools", binaryName)
      , path.resolve(this.sdkRoot, "tools", binaryName) ];
    // get subpaths for currently installed build tool directories
    var buildToolDirs = getDirectories(path.resolve(this.sdkRoot, "build-tools"));

    _.each(buildToolDirs, function (versionDir) {
      binaryLocs.push(path.resolve(this.sdkRoot, "build-tools", versionDir, binaryName));
    }.bind(this));

    _.each(binaryLocs, function (loc) {
      if (fs.existsSync(loc)) binaryLoc = loc;
    });

    if (binaryLoc === null) {
      cb(new Error("Could not find " + binary + " in tools, platform-tools, " +
                   "or supported build-tools under \"" + this.sdkRoot + "\"; " +
                   "do you have the Android SDK installed at this location?"));
      return;
    }
    logger.debug("Using " + binary + " from " + binaryLoc);
    binaryLoc = '"' + binaryLoc.trim() + '"';
    this.binaries[binary] = binaryLoc;
    cb(null, binaryLoc);
  } else {
    logger.error("The ANDROID_HOME environment variable is not set to the Android SDK root directory path. Please set the variable and restart.");
  }

Appium android driver.isAppInstalled & driver.installApp

Hi, I am using the code below to test an Android app using appium. However, the method driver.isAppInstalled does not return true when I do have the app installed in the device and the method
driver.installApp returns this error message:
org.openqa.selenium.WebDriverException: Unable to install [/walkman/apps/com.rdio.oi.android.ui-1.apk] to device with id [null]. Error [Error: spawn OK](WARNING: The server did not provide any stacktrace information)
Does anybody know how I can fix this issue?

### Code goes below

package dashboard.pageobjects.principal;

import static org.junit.Assert.*;
import java.net.URL;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.AppiumSetting;
import io.appium.java_client.MobileElement;
import io.appium.java_client.SwipeElementDirection;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidKeyCode;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class MainFlow {

AppiumDriver driver = null;
DesiredCapabilities capabilities = null;
WebDriverWait wait = null;

@BeforeClass
public void setUp() throws Exception {

    capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,
            MobilePlatform.ANDROID);
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,
            "Android device");
    capabilities.setCapability("device", "CB5A1X07H");
    capabilities.setCapability("appPackage", "com.sonyericsson.music");
    capabilities.setCapability("appActivity", ".MusicActivity");
    capabilities.setCapability("device-orientation", "portrait");
    capabilities.setCapability("locale", "en_US");
    capabilities.setCapability("language", "en");
    capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 120);

    driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),
            capabilities);
}

@AfterClass
public void tearDown() throws Exception {
    driver.quit();
}

@Test
public void test() throws InterruptedException {
    wait = new WebDriverWait(driver, 10);
    // By menu = By.className("android.widget.ImageButton");
    By disclaimer = By.id("com.sonyericsson.music:id/link");
    wait.until(ExpectedConditions.presenceOfElementLocated(disclaimer));
    driver.findElement(By.id("android:id/button1")).click();
    driver.swipe(20, 920, 890, 920, 0);
    if (driver.findElement(
            By.xpath("//android.widget.TextView[@text='Other Services']"))
            .isDisplayed());
    {
        //Install another app
        if(!driver.isAppInstalled("com.rdio.oi.android.ui"));
            //driver.installApp("apps/com.rdio.oi.android.ui-1.apk");
        driver.findElement(By.id("com.sonyericsson.music:id/artist2")).click();


    }

}

}

Excess quotes for ping command

I caught it once with appium.app 1.3.5 and Android Debug Bridge version 1.0.32

info: [debug] Error: Command failed: /bin/sh -c adb -s 07a5dfcc028abe54 "shell \"echo 'ping'\""

Testing system apps

Hi there, I have a situation where our app installs as a system app. Appium tries to do a pm list with -3 parameter which never returns our package. It would need to use -s

In any case, the issue is that Appium is not able to launch our activity. If I run the exact same shell am start command from the command line it works fine.

Are there any special flags I need to use to get appium to automate system apps?

Contributing docs don't mention how to add lint as a pre-commit hook

When I run "grunt lint" in the appium-adb submodule directory, lint is not detecting a file that I know has errors in it. I checked the .jshintrc file and it is the same as the one in Appium.

foo:~/SauceLabs/appium/submodules/appium-adb$ grunt lint
Running "newer:jshint" (newer) task

Running "newer:jshint:files" (newer) task

Running "jshint:files" (jshint) task
>> 0 files linted. Please check your ignored files.

Running "newer-postrun:jshint:files:1:/Users/foo/SauceLabs/appium/node_modules/grunt-newer/.cache" (newer-postrun) task

Running "newer:jshint:test" (newer) task
No newer files to process.

Running "newer:jshint:examples" (newer) task
No newer files to process.

Running "jscs:files" (jscs) task
>> 289 files without code style errors.

Done, without errors.

I'm not sure what the "ignored files" message is about.

isAppInstalled not working for some package names

From https://github.com/appium/appium-adb/blob/master/lib/adb.js#L1419
var apkInstalledRgx = new RegExp('^package:' + pkg.replace(/([^a-zA-Z])/g, "$1") + '$', 'm');

I'm no regex pro, but i think this isn't working for my pacakage because it has a number in it and it returns false. My app name is similar to "com.myapp.v1.nightly". When I run the "pm list packages -3 com.myapp.v1.nightly" myself in adb I do see the result and i'm able to uninstall the app just fine in appium.

The apk is not being installed with "-gr" key

The "-g" for the apkUtilsMethods.installFromDevicePath does not work for me.
The apk is not being installed from the /tpm folder.
This affects appium-adb 2.6.14
apk-utils.js:173

let stdout = await this.shell(['pm', 'install', '-gr', apkPathOnDevice], opts);

It works fine is the previous release (2.6.13) which has "-r" key only
My ADB version is:
Plevakos-829:appium-adb sergeyplevako$ adb version Android Debug Bridge version 1.0.36 Revision af05c7354fe1-android

Bug in v1.7.5 - appWaitActivity

If the appWaitActivity capability is comma-sepearted, like this:
appWaitActivity: com.example.demo.activities.Activity1,com.example.demo.activities.Activity2, then the launchApp fails.

The reason is, in adb.js, we are doing this in the method waitForActivityOrNot:

  1. Parsing the relative name of the activity given
  2. Then we are splitting by comma on the relative name (Refer: https://github.com/appium/appium-adb/blob/v1.7.5/lib/adb.js#L1285)

However, it should be:

  1. Split by comma first
  2. then we should parse the relative name of the activity.

Since appium v1.4.6 is dependent on appium-adb v1.7.5, this leads to the failure of automation. I can send you the PR for 1.7.5 if you confirm this is a valid bug.

Upgrade apk tool

Need to be merged after appium-boneyard/appium_apk_tools#8 is merged.

Getting this warning below.

Apparently need to upgrade to 2.0.0 (https://bitbucket.org/iBotPeaches/apktool/downloads)

➜  appium git:(v1.3.3) ✗ java -jar "/Users/baba/Documents/Work/a dir with white/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" stringsFromApk "/Users/baba/Documents/Work/a dir with white/appium/sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk" "/tmp/io.appium.android.apis"
Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:54)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:540)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:76)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:68)
    at io.appium.apktools.StringsXML.run(StringsXML.java:84)
    at io.appium.apktools.Main.main(Main.java:31)
Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
    at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
    at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:43)
    at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:100)
    at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
    ... 5 more

hideKeyboard doesn't work right with Appium UnicodeIME

When the Appium UnicodeIME is enabled (via "unicodeKeyboard: true" in desired capabilities) and active (e.g. a text field has been focused), doing hideKeyboard will result in an undesired back-button press.

This is because hideKeyboard first checks for an active software keyboard with isSoftKeyboardPresent, and this method correctly detects that the UnicodeIME is present, but the UnicodeIME has no UI to back out of.

Suggested potential fixes:

  • Make hideKeyboard detect the UnicodeIME and do nothing
  • Make isSoftKeyboardPresent detect the UnicodeIME and return false (hideKeyboard could then be wrapped in a try/catch)
  • Make UnicodeIME capable of accepting a back-button press

Rationale:
There are some tests I want to run both with and without the UnicodeIME. It would be nice if hideKeyboard worked correctly either way.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Optional Intent Arguments being stripped away

The problem

Optional Intent Arguments being stripped away when adb gets executed.

Environment

  • Appium version v1.5.3
  • Last Appium version that did not exhibit the issue: Didn't try an older version
  • Desktop OS/version used to run Appium: Mac OS v10.11
  • Node.js version (unless using Appium.app|exe): Using Appium.exe
  • Mobile platform/version under test: Android 6.0
  • Real device or emulator/simulator: Emulator
  • Appium CLI or Appium.app|exe: appium.exe

Details

Detail inside gist.

Link to Appium logs

https://gist.github.com/hariskhaliq/559fb8998a1bcad849ce43d28eba7b05

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.