appium / appium-adb Goto Github PK
View Code? Open in Web Editor NEWWrapper around adb used by appium + helper libs
License: Apache License 2.0
Wrapper around adb used by appium + helper libs
License: Apache License 2.0
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:
appium-adb/lib/tools/apk-utils.js
Line 171 in 806f31e
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!
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.
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?
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:
Guys, do you have any ideas how can I fix it?
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
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.
Getting ADB.createADB is not a function
error otherwise.
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.");
}
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.
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.
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
:
However, it should be:
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.
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:
$ npm cache clean
$ 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!
builds are passing with code errors
Custom sigalg / digestalg has been requested on the mailing list.
Line 401 in af9fd45
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'\""
🚨 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.
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>
🚨 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.
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)
Looking forward to index.d.ts declaration file with typescript
Warning:
These issues are not tracked. Please create new issues in the main Appium
repository: https://github.com/appium/appium/issues/new
such as https://github.com/konobi/node-adbhost/
this could help deal with android flakiness
The timeout is hardcoded at https://github.com/appium/appium-adb/blob/master/lib/tools/apk-utils.js#L157 to be 20000ms.
This fails roughly half the time for my application/env, for whatever reason, and there's really nothing further I can do to enhance my environment at the moment. It would be great if this were configurable.
Optional Intent Arguments being stripped away when adb gets executed.
Detail inside gist.
https://gist.github.com/hariskhaliq/559fb8998a1bcad849ce43d28eba7b05
See #3
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 :)
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?
I'm using 2.6.16 and is still getting this error:
[UiAutomator] Error while killing uiAutomator: Error: Unable to kill uiautomator processes. Original error: Unable to get pids for uiautomator. Orginial error: Could not extract PID from ps output: bad pid 'uiautomator'
Which is still caused by here: https://github.com/appium/appium-adb/blob/master/lib/tools/adb-commands.js#L429
After fixing this myself (removing , name
), it works fine again.
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
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:
false
(hideKeyboard could then be wrapped in a try/catch)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.
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
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]
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.
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);
});
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?
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();
}
}
}
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.