软录 · 2023年1月10日

appium运行app闪退|appium安装成功cmd运行appium-doctor报错(提示需修复appium-doctor)

❶ appuim启动报错

启动appium时,突然报错,这时候关键看这句话:main.js: error: Unrecognized arguments: file\base.apk.这里表示有个空找不着。原因是上次打开时,不小心将设置中的package选中,导致每次启动时,都会去检查package。但是没有使用package,就报错了。因此把package前面的勾去掉,再次运行,即可启动。拓展资料:appium 是一个自动化测试开源工具,支持 iOS 平台和 Android 平台上的原生应用,web应用和混合应用。其特点有:1.“移动原生应用”是指那些用iOS或者 Android SDK 写的应用(Application简称app)。2.“移动web应用”是指使用移动浏览器访问的应用(appium支持iOS上的Safari和Android上的 Chrome)。3.“混合应用”是指原生代码封装网页视图——原生代码和 web 内容交互。比如,像 Phonegap,可以帮助开发者使用网页技术开发应用,然后用原生代码封装,这些就是混合应用。重要的是,appium是一个跨平台的工具:它允许测试人员在不同的平台(iOS,Android)使用同一套API来写自动化测试脚本,这样大大增加了iOS和Android测试套件间代码的复用性。appium是跨平台的,可以用在OSX,Windows以及Linux桌面系统上运行。appium选择了Client/Server的设计模式。只要client能够发送http请求给server,那么的话client用什么语言来实现都是可以的,这就是appium及Selenium(WebDriver)如何做到支持多语言的原因;appium扩展了WebDriver的协议,没有自己重新去实现一套。这样的好处是以前的WebDriver API能够直接被继承过来,以前的Selenium(WebDriver)各种语言的binding都可以拿来就用,省去了为每种语言开发一个client的工作量。

❷ Appium超时错误连接到驱动程序时问题,怎么解决

问题

1. error: Failed to start an Appium session, err was: Error: Requested a new session but one was in progress

之前的会话没有关闭,然后你又运行了测试实例,也没有设置覆盖.解决:1.重新停止appium服务,开启Appium服务2.在Genarel Setting那里设置覆盖Session,重启Appium

测试结束在AfterClass加driver.quit()

2. error: Failed to start an Appium session, err was: Error: Command failed: C:Windowssystem32cmd.exe /s /c "D:android-sdk-windowsplatform-toolsadb.exe -s adb server version (32) doesn't match this client (36); killing…

wait-for-device"error: could not installsmartsocketlistener: cannot bind to 127.0.0.1:5037:

没有链接上手机或者模拟器,请确认已经连接成功,重新链接

3. error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.

手机系统低于4.2,appium不支持4.2.2以下的系统,请换一个手机或者模拟器来测试。

4. Error: Permission to start activity denied.

**activity在清单文件里面没添加Android:exported="true"的话,你不能直接打开对应的activity,需要从启动页activity打开。exported属性就是设置是否允许activity被其它程序调用**

5. error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist or cannot ve launched! Make usre it exists and is launchable activity

要打开的activity不存在,activity路径错误,改为完整正确的activity路径

6. error: Failed to start an Appium session, err was: Error: 'java – version' failed. Error: Command failed: C:Windowssystem32cmd.exe /s /c "java -version"

Java版本错误,请安装最新的版本。

7.> info: [debug] Error: Command failed: C:Windowssystem32cmd.exe /s /c "D:android-sdk-windowsplatform-toolsadb.exe -s 8806a0b0 shell "echo 'ready'"error: unknown host service

链接手机失败,重新链接手机即可,我就是重新拔插了一下usb

Error: Command failed: C:Windowssystem32cmd.exe /s /c "D:android-sdk-windowsplatform-toolsadb.exe -s 8806a0b0 shell "echo 'ping'""

error: unknown host service

adb被突然占用导致,例如你在运行用例的时候运行了模拟器。

8. UIAutomatorViewer提示: Unable to connect to adb. Check if adb is installed correctly

解决,sdk升级到了25产生的问题。

解决方法:

将adb.exe复制一份到uiautomatorviewer.bat目录下

修改uiautomatorviewer.bat文件最后一行(改binddir=%prog_dir%为自己的platform-tools本地路径)

9 error: Failed to start an Appium session, err was:INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling

When you are at final step to execute test automation script for mobile app testing on a mobile emulator or a virtual device or a real device, you might observe that script execution fails with different kinds of errors, In context to current article you will look at the error and solutions for: INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.

Error in Appium Server:

1

2

3

4

5

6

7

8

Error: Command failed: C:Windowssystem32cmd.exe /s /c

"C:Users{User}-toolsadb.exe -s

emulator-5554 install

"C:Program Files (x86)Appiumode_molesappiumuildsettings_apksettings_apk-debug.apk""

> Failed to install C:Program Files (x86)Appiumode_molesappiumuildsettings_apk

settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install

io.appium.settings without first uninstalling.]

Error in Android studio run console:

1

2

3

4

5

6

7

8

9

org.openqa.selenium.SessionNotCreatedException: A new session could not be created.

(Original error: Command failed: C:Windowssystem32cmd.exe /s /c

"C:Users{User}-toolsadb.exe -s emulator-5554 install

"C:Program Files (x86)Appiumode_molesappiumuildsettings_apksettings_apk-debug.apk""

Failed to install C:Program Files (x86)Appiumode_molesappiumuildsettings_apk

settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install

io.appium.settings without first uninstalling.]

) (WARNING: The server did not provide any stacktrace information)

Command ration or timeout: 0 milliseconds

For the first time when you execute the script itmight pass, but it will fail with above error when you try to execute the same or any other script multiple times. Or when your test script execution fails on the first attempt for some other reason, and when you fix it and execute it again, you might encounter this new issue.

原因:

The reason for this error is that Appium installs 2 mobile applications before executing the script.

1. io.appium.settings

2. io.appium.unlock

Theseare the supportive mobile applications appium utilizes to execute the test automation script in Mobile Emulator or virtual device or a real mobile device.

Ideally Appium should remove these files every time at the end of the script execution or termination, if it is intends to install themevery time a script is executed, or it should conditionally install these apps / apksto the mobile emulator or mobile device.

In your mobile emulator / Virtual Device / Real device, the 2 mobile applications appear as below:

There are multiple ways to troubleshootthis error and go ahead for asuccessful test script execution.

解决办法

Solution 1: ADB's uninstall command to remove the files.

You can open command prompt, assuming that you already had set the environment variables for ANDROID_HOME and Path variables for sdk tools and platform tools.

And execute commands as shown below:

Solution 2: Uninstall manually

You can open the mobile emulator / virtual device / real device and go to apps and uninstall them.

Solution 3: Write code as part of your test automation script.

As part of your selenium test automation script, you could write instructions to execute the commands provided in solution 1 above, so that this issue would not arise.

Hope this article has been helpful and you are able to proceed further with script execution.

Request to kindly share any of your queries in form of comments, we would try our best to provide any solution for you.

10.出错信息里含有"ps 'uiautomator',具体信息未 A new session could not be created. (Original error: Command failed: C:Windowssystem32cmd.exe /s /c "C:Userssxie-toolsadb.exe -s emulator-5554 shell "ps 'uiautomator'""

android-appium: A new session could not be created

junitexceptionandroidappium自动化

detail log:org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: C:Windowssystem32cmd.exe /s /c "C:Userssxie-toolsadb.exe -s emulator-5554 shell "ps 'uiautomator'"") (WARNING: The server did not provide any stacktrace information)Command ration or timeout: 0 millisecondsBuild info: version: '3.4.0', revision: 'unknown', time: 'unknown'System info: host: 'WL00070299', ip: '10.110.12.39', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_40'Driver info: driver.version: AndroidDriverat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)at sun.reflect..newInstance(Unknown Source)at java.lang.reflect.Constructor.newInstance(Unknown Source)at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:161)at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:76)at io.appium.java_client.remote.AppiumCommandExecutor.doExecute(AppiumCommandExecutor.java:111)at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:162)at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137)at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88)at io.appium.java_client.AppiumDriver.(AppiumDriver.java:112)at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:73)at com.sky.demo.ContactTest.setUp(ContactTest.java:44)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)at org.junit.runners.ParentRunner$1.schele(ParentRunner.java:71)at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)at org.junit.runners.ParentRunner.run(ParentRunner.java:363)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:459)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

==========================================直接在cmd中执行"C:Windowssystem32cmd.exe /s /c "C:Userssxie-toolsadb.exe -s emulator-5554 shell "ps 'uiautomator'""bad pid 'uiautomator'", 报错: bad pid 'uiautomator'

代码内容为

public class ContactTest {private AndroidDriver driver;@Beforepublic void setUp() throws Exception {//设置apk的路径File classpathRoot = new File(System.getProperty("user.dir"));File appDir = new File(classpathRoot, "apps");File app = new File(appDir, "ContactManager.apk");

//设置自动化相关参数 DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); capabilities.setCapability("automationName","Appium"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("deviceName", "Pixel_XL_API_25");// Galaxy_Nexus_API_25 capabilities.setCapability("noReset", true); capabilities.setCapability("avdReadyTimeout", 300000); capabilities.setCapability("sessionOverride", true); //设置安卓系统版本 capabilities.setCapability("platformVersion", "7.1.1"); //设置apk路径 capabilities.setCapability("app", app.getAbsolutePath()); //设置app的主包名和主类名 capabilities.setCapability("appPackage", "com.example.android.contactmanager"); capabilities.setCapability("appActivity", ".ContactManager"); //初始化 driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS); }@Testpublic void addContact(){ WebElement el = driver.findElement(By.name("Add Contact")); el.click(); List<WebElement> textFieldsList = driver.findElementsByClassName("android.widget.EditText"); textFieldsList.get(0).sendKeys("feimaoyuzhubaobao"); textFieldsList.get(2).sendKeys("forever together"); driver.swipe(100, 500, 100, 100, 2); driver.findElementByName("Save").click();} @Afterpublic void tearDown() throws Exception { driver.quit();}

}

解决办法:

resolved by this way:adb.js(C:Program Files (x86)Appiumode_molesappiumode_molesappium-adblibadb.js) 中1035 行this.shell("ps '" + name + "'", function (err, stdout) {对应执行的指令是ps 'uiautomator', Android7不支持这个指令格式,所以执行结果是bad pid 'uiautomator'目前Appium未对此进行处理,所以需要修改此指令的执行方式即将this.shell("ps '" + name + "'", function (err, stdout) {if (err) return cb(err);替换成this.shell_grep("ps", name, function (err, stdout) {

if (err) {

logger.debug("No matching processes found");return cb(null, []);

}

并增加上面用到的shell_grep函数:ADB.prototype.shell_grep = function (cmd, grep, cb) {if (cmd.indexOf('"') === -1) {cmd = '"' + cmd + '"';}var execCmd = 'shell ' + cmd + '| grep ' + grep;this.exec(execCmd, cb);

};

11.Android 7.0系统的手机无法执行appium脚本的问题

AppiumAppium 版本 1.4.16,Android 设备固件 7.x,执行脚本时,报错使用语言:python报错如下:WebDriverException: Message: A new session could not be created. (Original error: Could not extract PIDs from ps output. PIDS: [], Procs: ["bad pid 'uiautomator'"])

这个是因为appium版本1.4.16使用的uiatumator1.0不支持的原因导致?如果不升级appium版本,是否有解决方案?

解决办法

uiautomator1.0应该是不支持7.0,不升版本就换用uiautomator2.0吧,或者用下面的改脚本的方法使用。

解决Android 7.0系统的手机无法执行appium脚本的问题,改问题的具体解决方法如下:

找到appium的安装目录下的adb.js文件,windows版本的目录如下:Appiumode_molesappiumode_molesappium-adblib2、打开adb.js,手动修改该文件下的内容,此方法我已经试验成功。

adb.js 中1035 行this.shell("ps '" + name + "'", function (err, stdout) {对应执行的指令是ps 'uiautomator', Android7不支持这个指令格式,所以执行结果是bad pid 'uiautomator'目前Appium未对此进行处理,所以需要修改此指令的执行方式即将this.shell("ps '" + name + "'", function (err, stdout) {if (err) return cb(err);替换成this.shell_grep("ps", name, function (err, stdout) {if (err) {

logger.debug("No matching processes found");return cb(null, []);

}

并增加上面用到的shell_grep函数:ADB.prototype.shell_grep = function (cmd, grep, cb) {if (cmd.indexOf('"') === -1) {cmd = '"' + cmd + '"';}var execCmd = 'shell ' + cmd + '| grep ' + grep;this.exec(execCmd, cb);

};

网上还有如下的修改解决办法:以下我未试验。ADB.prototype.getPIDsByName = function (name, cb) {logger.debug("Getting all processes with '" + name + "'");this.shell("ps '" + name + "'", function (err, stdout) {if (err) return cb(err);stdout = stdout.trim();var procs = [];var outlines = stdout.split("");outlines.shift(); //在该处添加此行代码3、重启appium

技巧

1.每次测试都重新安装app

为capabilities色设置noReset为truecapabilities.setCapability("noReset", true);

2.中文乱码

这都是编码问题:

1.方法1:

Android Studio修改文件编码的方法,最底部的UTf-8,点击选GBK就可以了,reload文件。(ps:先把文件内容全选复制一下再转换编码,再粘贴,不然文件内容就变乱码了)

2.方法2:

用的是原来的UTF-8编码,然后在测试mole的build.gradle里面添加三行代码

tasks.withType(JavaCompile){

options.encoding = 'UTF-8'

}

3.清除编辑框EditText内容

这个问题好像是看手机系统的,我之前的手机就会出现sendKeys的时候没有全选去掉本来的内容,现在都会自动全选覆盖了,这个也不算问题了。

/**

* 逐字删除编辑框中的文字

* @param element 文本框架控件

*/

public void clearText(AndroidElement element){

String className = element.getClass().getSimpleName();

if (className.equals("EditText")){

String text = element.getText();

//跳到最后

driver.pressKeyCode(KEYCODE_MOVE_END);

for (int i = 0; i < text.length(); i ++){

//循环后退删除

driver.pressKeyCode(BACKSPACE);

}

}else {

print("不是文本输入框架,无法删除文字");

}

}

1

4.点击输入法键盘的回车搜索

方法1:切换输入法

利用adb命令先切换为自己的输入法,按了搜索再切换为appium的输入法

查看当前手机的输入法

cmd执行下面的的代码

adb shell ime list -s

可以看到类似下面的结果,

C:UsersLITP>adb shell ime list -s

com..input_mi/.ImeService

com.sohu.inputmethod.sogou.xiaomi/.SogouIME

io.appium.android.ime/.UnicodeIME

C:UsersLITP>

执行adb命令

先写好一个执行cmd的方法

/**

* 执行adb命令

* @param s 要执行的命令

*/

private void excuteAdbShell(String s) {

Runtime runtime=Runtime.getRuntime();

try{

runtime.exec(s);

}catch(Exception e){

print("执行命令:"+s+"出错");

}

}

在需要搜索的时候执行下面的代码,切换的输入法用自己查看列表的输入法内容,我这里是搜狗输入法

//使用adb shell 切换输入法-更改为搜狗拼音,这个看你本来用的什么输入法

excuteAdbShell("adb shell ime set com.sohu.inputmethod.sogou.xiaomi/.SogouIME");

//再次点击输入框,调取键盘,软键盘被成功调出

clickView(page.getSearch());

//点击右下角的搜索,即ENTER键

pressKeyCode(AndroidKeyCode.ENTER);

//再次切回 输入法键盘为Appium unicodeKeyboard

excuteAdbShell("adb shell ime set io.appium.android.ime/.UnicodeIME");

❸ [求助] appium 真机运行APP点击滑动测试出错,

启动appium,执行testng测试脚本,脚本启动配置项如下:import io.appium.java_client.AppiumDriver;import org.openqa.selenium.By;import org.openqa.selenium.WebElement;import org.openqa.selenium.remote.CapabilityType;import org.openqa.selenium.remote.DesiredCapabilities;DesiredCapabilities capabilities = new DesiredCapabilities();capabilities.setCapability(CapabilityType.BROWSER_NAME, "");//这句不是必须的capabilities.setCapability("deviceName","Android Emulator");capabilities.setCapability("platformVersion", "4.4");capabilities.setCapability("platformName","Android");capabilities.setCapability("appPackage", "com.android.calculator2");capabilities.setCapability("appActivity", ".Calculator");AppiumDriver driver = new AppiumDriver(new URL(""), cap

❹ Appium进行真机测试时总是会闪退是怎么回事

可以尝试以下方法看看:1、点击设置-应用程序-全部-找到该软件–清除数据,清除一下软件数据再打开。2、卸载后重新下载安装相应的程序。3、如果是所有的软件都出现打开慢或者打开有问题的情况,可以备份在recovery里清空缓存和用户数据试一下。方法:关机状态下,先按住“音量增加键”再按住“电源键”,等出现开机画面时松手,进入Recovery。选择简体中文>清除数据>清除缓存+清除用户数据。提示:Recovery状态下触摸屏暂时失效,用“电源键”确认,“音量键”选择。4、如果通过上述方法操作后,相应的程序都有问题,而其他软件程序都正常的话,可以判断该程序跟系统不兼容,可以尝试更换其他版本的程序或者游戏试一下。5、建议备份重新线刷一下系统版本后尝试。

❺ Appium运行脚本失败

首先,要保证appium服务正确的启动了,这是第一步 看楼上应该是appium配置出了问题。 appium主要需要配置两个地方,一个是sdk路径,一个是ip+端口号 配置完了之后,启动appium: 如果你连了手机,或开了模拟器,启动成功时如下,如果有error,说明启动不成功,需要查看error是什么,并修改。

❻ appium安装成功,cmd运行appium-doctor,报错(提示需修复appium-doctor),请问大神们怎么解决

这个提示的意思是ANDROID_HOME没有设置。所以请配置ANDROID_HOME到系统的环境变量中(就是android的sdk目录回)设置完成后,重答新启动一个新的cmd窗口,运行appium-doctor

❼ 为什么 appium 一调试就出现问题

问题现象:安装maven插件后,每次启动包Eclipse is running in a JRE, but a JDK is required.Some Maven plugins may not work when importing projects or updating source folders.根本原因是eclipse没有使用JAVA_HOME,而是使用的c:\windows\system32(64位系统是syswow64目录)中的javaw.exe启动的,而Maven在进行编译运行时可能会使用到JDK相关的工具(例如:com.sun.tools.jar)。解决方法:在eclipse中Window进入Preferences,选择Installed JREs添加一个JRE为JDK的安装目录并设置其为默认JRE。然后修改eclipse安装目录下的eclipse.ini文件,在该配置文件头部添加如下两行:-vmD:/Java/jdk1.8.0_20/bin/javaw //jdk的安装目录,注意路径中不要有空格若JDK的安装路径为默认路径,即C:\Program Files,路径中含有空格,则此处应该配置为C:\PROGRA~1;若为C:\ Program Files (x86),此处应该配置为C:\PROGRA~2END2 Appium 报Could not push strings.json1问题现象:error: Failed to start an Appium session, err was: Error: Could not push strings.json> info: [debug] Cleaning up android objects > info: [debug] Cleaning up appium session> info: [debug] Error: Could not push strings.json> at E:\Appium\node_moles\appium\lib\devices\android\android.js:323:26> at null.<anonymous> (E:\Appium\node_moles\appium\node_moles\appium-adb\lib\adb.js:170:16)> at ChildProcess.exithandler (child_process.js:641:7)> at ChildProcess.EventEmitter.emit (events.js:98:17)> at maybeClose (child_process.js:743:16)> at Process.ChildProcess._handle.onexit (child_process.js:810:5)> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not push strings.json)","origValue":"Could not push strings.json"},"sessionId":null}> info: [37m<– POST /wd/hub/session [39m[31m500[39m[90m 10085.061 ms – 176[39m [90m[39m 解决方法:清理电脑内存,修改模拟器SD卡空间END3 部分手机用Swipe滑动引导图片无效问题现象:部分手机用swipe方法模拟滑动引导图片时,出现无效或未按预期执行的现象解决方法:调整swipe最后一个参数rationdriver.swipe(xStart, yStart, xEnd, yEnd, 100);END4 定位Android设备或模拟器页面元素1问题现象:编写脚本时,往往需要定位元素,但常用的name常常出现定位不到的问题,此时就需要通过classname和id来定位(id定位需要Android系统版本4.2及以上)。解决方法:1、连接上设备或模拟器,进入SDK的tools目录下,启动uiautomatorviewer.bat2、 Ui Automator Viewer打开后点击按钮 Device Screenshot就可以看到当前设备或模拟器视图,在右侧可以看到视图的元素。如图:

❽ 使用appium+jdk+eclipse向安卓手机里安装的apk,安装完后软件闪退

笨啊,打的软件是经过调试好了的

❾ Appium运行java脚本,报错Activity used to start app doesn't exist or cannot be launched!Make sure

1、在你的程序中,初始化appium设置的appActivity这项,值不对,不是当前被测app启动时调用的activity

可以通过命令行aapt mp badging D:xxx.apk,可以检查到此apk的packageName和activityName

要求先进去androidSDK的build-tools目录下