尝试运行自动脚本以在实际设备上启动应用程序时出现 Appium 错误



Friends,以下是appium错误日志:你能帮我解决这个问题吗

我以 junit 身份运行,我应该以测试/安卓应用程序运行吗?

AndroidMainfest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.demo"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="21" />
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

.java文件:

package demolaunchtest;
import static org.junit.Assert.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
public class helloTest {
public static AndroidDriver driver;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
File appDir = new File ("Computer\Lokesh Gangaiah\Phone\Download");
File app = new File (appDir,"selendroid-test-app-0.17.0.apk");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("browserName", "");
        //capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("deviceName", "Lokesh Gangaiah");
        capabilities.setCapability("platformVersion", "5.0");
        capabilities.setCapability("device", "Android");
        capabilities.setCapability("app",app.getAbsolutePath());
        capabilities.setCapability("appPackage", "io.selendroid.testapp");
        capabilities.setCapability("appActivity", "io.selendroid.testapp.HomeScreenActivity");
        driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }
@Test
public void test() {
    System.out.println("Hello");
    // fail("Not yet implemented");
}

}

=

信息: [调试] 清理应用程序会话 错误:无法启动 Appium 会话,错误为:错误:具有互联网权限从清单失败。错误:命令失败:C:\Windows\system32\cmd.exe/s/c "C:\Users\GangaiahL\AppData\Local\Android\sdk\build-tools\23.0.1\aapt.exe dump badgeging " 错误:未指定转储文件

信息: [debug] 错误: InternetPermissionFromManifest 失败。 错误:命令失败:C:\Windows\system32\cmd.exe/s/c "C:\Users\GangaiahL\AppData\Local\Android \sdk\build-tools\23.0.1\aapt.exe dump badgeging " 错误:未指定转储文件

at C:Program  Files (x86)Appiumnode_modulesappiumnode_modulesappium-adblibadb.js:1664:19
at     ChildProcess.exithandler (child_process.js:758:5)
at ChildProcess.emit (events.js:110:17)
   at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit     (child_process.js:1088:5)

信息: [调试] 响应客户端错误: {"状态":33,"值": {"消息":"无法创建新会话。(原始错误:有 InternetPermissionFromManifest 失败。错误:命令失败:C:\Windows\system32\cmd.exe/s/c \"C:\Users\GangaiahL\ \AppData\Local\Android\sdk\build-tools\23.0.1\aapt.exe dump badgeging \"ERROR: 未指定转储文件\r)","origValue":"hasInternetPermissionFromManifest failed.错误:命令失败:C:\ \Windows\system32\cmd.exe/s/c \"C:\Users\GangaiahL\AppData\Local\Android\sdk\build- tools\23.0.1\aapt.exe dump notging \"错误: 未指定转储文件\r"},"sessionId":null} 信息: <-- 开机自检/wd/hub/session 500 568.702 ms - 594

新错误:

信息: [调试] 响应客户端错误: {"状态":33,"值":{"消息":"无法创建新会话。(原始错误:有 InternetPermissionFromManifest 失败。错误:命令失败:C:\Windows\system32\cmd.exe/s/c \"C:\Users\GangaiahL\AppData\Local\Android\sdk\build-tools\23.0.1\aapt.exe dump badging \"ERROR: 未指定转储文件\r)","origValue":"hasInternetPermissionFromManifest failed。错误:命令失败:C:\Windows\system32\cmd.exe/s/c \"C:\Users\GangaiahL\AppData\Local\Android\sdk\build-tools\23.0.1\aapt.exe dump notging \"错误: 未指定转储文件\r"},"sessionId":null} 信息: <-- 开机自检/wd/hub/session 500 566.022 ms - 594

##Error 1:
    By seeing your java code, I see this line is the problem:
    capabilities.setCapability("app","app.getAbsolutePath()");
    If app is a variable then it should be without quotes like:
    capabilities.setCapability("app",app.getAbsolutePath());
    Because of this appium can't find the app file to dump.

## Error 2:
Change these:
   File appDir = new File ("Computer\Lokesh Gangaiah\Phone\Download");
   File app = new File (appDir,"selendroid-test-app-0.17.0.apk");
to:
   File app = new File ("Computer\Lokesh Gangaiah\Phone\Download\selendroid-test-app-0.17.0.apk");
And make sure you have apk file at this location.

相关内容

  • 没有找到相关文章

最新更新