标签: appium-android

在app中运行仪器测试并等待结果

我正在开发一种QA自动化解决方案,可以在Android上记录/回放QA测试.关键业务要求是在回放录制的测试时不依赖于连接的PC.为此,我试图在没有连接PC的情况下运行仪器测试.(具体来说,是Appium UiAutomator2测试).

我目前的方法是尝试从我的应用程序以编程方式运行测试.如果我通常从连接的PC运行测试,我会使用该命令adb shell am instrument -w.我尝试从我的应用程序访问ADB Shell并运行am instrument -w,但这会产生错误,我错过了INTERACT_ACROSS_USERS_FULL权限.

为了解决这个问题,我尝试使用startInstrumentation运行测试.这成功地开始了测试.但是,测试立即崩溃.经过进一步调查,我将崩溃追踪到NPE:测试试图检索InstrumentationRegistry.getInstrumentation.getUiAutomation(0),但是返回null.

如何以编程方式运行测试并授予其访问所需的UiAutomation实例的权限?

这就是我开始测试的方式:

public void runTest() {
    final String pm = getPackageName().replaceFirst(".test$", "");
    final InstrumentationInfo info = getInstrumentationInfo(pm);
    if (info != null) {

        final ComponentName cn = new ComponentName(info.packageName,
                info.name);

        Bundle arguments = new Bundle();
        arguments.putString("class", "io.testim.appiumwrapper.test.AppiumUiAutomator2Server");
        //cn = {io.extension.test/android.support.test.runner.AndroidJUnitRunner}
        startInstrumentation(cn, null, arguments);

    } 
}
Run Code Online (Sandbox Code Playgroud)

android android-testing appium android-instrumentation appium-android

20
推荐指数
1
解决办法
788
查看次数

我无法将 appium-server 桌面和 appium Inspector 与我的智能手机连接,但我可以看到我的设备在 Windows 终端中连接良好

我只是使用 Appium-desktop 在与我的智能手机连接期间查看日志,并使用 Appium-inspector 来检查 DOM,我是这个练习的新手,我搜索了很多,目前没有任何结果。我可以看到我的智能手机连接良好并且服务器似乎可以正常工作。
在此输入图像描述

我在 C:\Users<USERNAME>\AppData\Local 中创建了一个 Android 文件夹,在其中安装了 cmdline-tools、platform-tools 并运行命令:
sdkmanager "build-tools;28.0.3" 以安装其他软件包Android 文件夹
我的环境:

OS : Windows 10  
Appium version : 1.22.0  
Node : v14.17.6  
Npm : 6.14.15  
Sdkmanager : 4.0.1  
Run Code Online (Sandbox Code Playgroud)

我用图片向您展示了 Appium-desktop 在启动时和过程中的状态
在此输入图像描述

我的主机是0.0.0.0,端口:4723
在此输入图像描述

Disared capabilities: platformName: Android  
                      deviceName: HUAWEI VNS-L31  
                      udid: FUH7N16607025752  
                      plateformVersion: 7.0  
Run Code Online (Sandbox Code Playgroud)

不幸的是,当我开始会话时它不起作用
在此输入图像描述
在此输入图像描述

我有这个错误消息:

"Error
Failed to create session. The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped …
Run Code Online (Sandbox Code Playgroud)

appium-android

15
推荐指数
2
解决办法
5万
查看次数

“Appium”无法打开,因为苹果无法检查它是否有恶意软件

当我尝试在 mac 上打开 appium 时,出现错误 \xe2\x80\x9cAppium\xe2\x80\x9d can\xe2\x80\x99t 无法打开,因为 Apple 无法检查它是否存在恶意软件。

\n

automation appium android-studio appium-android appium-desktop

10
推荐指数
2
解决办法
2万
查看次数

使用Python在Appium/Android上选择一个元素,该元素在UIAutomatorViewer上具有相同的Class和另一个元素的相同索引

我正在测试一个应用程序,在大多数屏幕上,我看到有些元素具有相同的类"android.widget.TextView",索引号为"0".所有其他属性也相同,只有例外是"文本"和"绑定".

我将"跳过","下一步"和"跳过下一个3"作为屏幕上的文本,其具有除文本和边界属性之外的相同属性.我需要知道如何点appium点击所需的项目..说我想点击"下一步",我该怎么做.我正在使用Python进行脚本编写.

python android appium uiautomatorviewer appium-android

9
推荐指数
1
解决办法
1183
查看次数

Travis CI - 无法删除端口转发错误执行adbExec

我正在尝试使用Appium(npm版本)为Android应用程序设置自动化测试,但我一直收到错误

[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id [UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command '/usr/local/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp\:8200' exited with code 1'; Stderr: 'error: listener 'tcp:8200' not found'; Code: '1''

我已经浏览了谷歌多年,但是能够找到任何实际上对我有用的解决方案,到目前为止共有50个失败的版本.

如果我在我的本地机器上运行命令它工作正常但在travis内我很遗憾没有这样的运气.我是设置appium的新手,所以它可能是一些不太理解的东西.

我的travis.yml文件的要点就在这里

分配: Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty

提前致谢.

travis-ci appium appium-android

8
推荐指数
1
解决办法
583
查看次数

如何从APPIUM中的脚本滚动列表

嗨,我在Android中使用APPIUM.我需要做的是明智地滚动列表页面.我试着做以下.

    MobileElement element =(MobileElement)driver.findElement(By.className("android.widget.ListView"));
    JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap<String, String> scrollObject = new HashMap<>();
    scrollObject.put("direction", "down");
    scrollObject.put("element", ((RemoteWebElement) element).getId());
    js.executeScript("mobile: scrollTo", scrollObject);
Run Code Online (Sandbox Code Playgroud)

这可以工作,但列表会连续滚动,直到显示最后一个元素.我需要做的是明智地滚动列表页面.

android listview scroll appium appium-android

7
推荐指数
1
解决办法
1587
查看次数

app:transformDexArchiveWithExternalLibsDexMergerForDebug在Android Studio 3.0.1中

Message Gradle构建:

错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。

java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex

这是gradle构建文件:

apply plugin: 'com.android.application'

    android {

        compileSdkVersion 26
        defaultConfig {

            minSdkVersion 26
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true

        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {

        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso 
        core:3.0.1'
        implementation files('libs/bsh-core-2.0b4.jar')
        implementation files('libs/selenium-java-2.3.0.jar')
        implementation files('libs/selenium-remote-driver-3.0.0.jar')
        // https://mvnrepository.com/artifact/io.appium/java-client
        implementation  group: 'io.appium', name: 'java-client', version: '5.0.4'

    }
Run Code Online (Sandbox Code Playgroud)

android dex android-gradle-plugin appium-android

7
推荐指数
1
解决办法
1万
查看次数

在 Mac 上使用 appium 工具安装应用程序时出现包和活动错误

我正在使用 appium 工具测试我的应用程序。在测试过程中,Android 应用程序在启动器 Activity 附近崩溃,仅在版本低于 8 的部分设备中显示以下错误。如何修复?

处理命令时发生未知的服务器端错误。原始错误:无法启动“com.bodaty.samyata.samyata09.login.launcheractivity”或“com.bodaty.samyata.samyata09.com.bodaty.samyata.samyata09.login.launcheractivity”从未启动。

[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: …
Run Code Online (Sandbox Code Playgroud)

appium appium-android

7
推荐指数
1
解决办法
6644
查看次数

处理命令时发生未知的服务器端错误。无法将命令代理到远程服务器。原始错误:错误:套接字挂起

如果我运行 TestNG 测试类,它会显示错误 ------------

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. 
Original error: Could not proxy command to remote server. Original error: Error: socket hang up (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 281 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'MON-PC305', ip: '10.101.0.119', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.app.android.game.app, statBarHeight=84, noReset=false, viewportRect={top=84, left=0, width=1440, height=2308}, deviceName=emulator-5554, …
Run Code Online (Sandbox Code Playgroud)

android exception driver appium-android

6
推荐指数
2
解决办法
5万
查看次数

java.lang.NoSuchMethodError: 'void org.openqa.selenium.remote.http.ClientConfig.&lt;init&gt;(java.net.URI, java.time.Duration, java.time.Duratio

当我尝试在相关设备中启动该应用程序时,我收到以下错误消息,如果有人遇到并已解决,请提供帮助。

java.lang.NoSuchMethodError: 'void org.openqa.selenium.remote.http.ClientConfig.(java.net.URI, java.time.Duration, java.time.Duration, org.openqa.selenium.remote.http.Filter ,java.net.Proxy,org.openqa.selenium.Credentials)'

appium-android

6
推荐指数
2
解决办法
5712
查看次数