标签: appium-android

Android - Appium 向下滑动不起作用

我正在尝试向下滑动联系人屏幕,但它不起作用。

这是我尝试过的代码。

public void Swipedown() throws InterruptedException
{
  // Select till which position you want to move the seekbar
  TouchAction action=new TouchAction((PerformsTouchActions) driver);
  Dimension dimensions = driver.manage().window().getSize();

  action.press(446,1404).moveTo(554,1500).release().perform(); 

    System.out.println("swipe down to set seekbar successfully");
    Thread.sleep(5000);
    }
Run Code Online (Sandbox Code Playgroud)

你们能帮我看看我在这里做错了什么。
任何帮助将不胜感激。

java automation android appium appium-android

4
推荐指数
1
解决办法
1981
查看次数

appium - 如何获取本机 Android 应用程序中元素的背景颜色

我正在尝试使用自动化应用程序appium。如何获取 Android 应用程序中元素的背景颜色。

我尝试使用

element.getCssValue("background-color")
Run Code Online (Sandbox Code Playgroud)

但我面临以下异常:

java.lang.ClassCastException:com.google.common.collect.Maps$TransformedEntriesMap 无法在 io.appium 的 org.openqa.selenium.remote.RemoteWebElement.getCssValue(RemoteWebElement.java:167) 处转换​​为 java.lang.String。 java_client.DefaultGenericMobileElement.getCssValue(DefaultGenericMobileElement.java:177) 在 io.appium.java_client.MobileElement.getCssValue(MobileElement.java:1) 在 io.appium.java_client.android.AndroidElement.getCssValue(AndroidElement.java:1) 在 com .mahindracomviva.digibanktest.tests.corecontrollers.DynamicControlsTest.validateThemeColor(DynamicControlsTest.java:130) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) 在sun.reflect.NativeMethodAccessorImpl.invoke(未知来源) 在sun.reflect.DelegatingMethodAccessorImpl。在 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) 处的 java.lang.reflect.Method.invoke(未知来源) 处调用(未知来源) org.junit.internal.runners.model 处。 ReflectiveCallable.run(ReflectiveCallable.java:12) 在 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 在 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)在 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 在 org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) 在 org.junit.runners.ParentRunner .runLeaf(ParentRunner.java:325) 在 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 在 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 在 org.junit.runners。 ParentRunner$3.run(ParentRunner.java:290) 在 org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 在 org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 在 org.junit .runners.ParentRunner.access$000(ParentRunner.java:58) 在 org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 在 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java :26)在org.junit.runners.ParentRunner.run(ParentRunner.java:363)在org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)在org.eclipse.jdt。 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) 在 org.eclipse.jdt.internal.junit 处的internal.junit.runner.TestExecution.run(TestExecution.java:38)。 runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner。主要(RemoteTestRunner.java:206)

appium appium-android

4
推荐指数
1
解决办法
4422
查看次数

如何长时间维持Appium会话

我需要在测试中间等待5分钟,但Appium会话的默认newCommandTimeout为60s。并且在下一个命令我的会话超时的指令中出现异常。

AndroidDriver appiumDriver = new AndroidDriver(new URL(getMcmUrl()), capabilities);
Thread.sleep(5*60*1000); // 5 minutes sleep time
appiumDriver.executeScript("...")
Run Code Online (Sandbox Code Playgroud)

webdriver appium appium-ios appium-android appium-desktop

4
推荐指数
2
解决办法
1345
查看次数

使用 appium 运行测试脚本时出现 SecurtyException

我在执行 Appium 脚本时遇到安全异常

大家好,我是 appium 新手,正处于 appium 工具的学习阶段。我创建了一个脚本来开始基本测试。我收到以下更新错误。

我通过 USB 调试连接了我的设备,设备也在 adb 中列出。但是当我执行它时抛出错误。下面是附加的代码和错误日志。

DesiredCapabilities desire=new DesiredCapabilities();
        desire.setCapability("deviceName", "Redmi");
        desire.setCapability("udid", "3cbaf93d");
        desire.setCapability("platformName", "Android");
        desire.setCapability("platformVersion", "9.0");
        desire.setCapability("appPackage", "com.androi.camera");
        desire.setCapability("appActivity", "com.androi.camera.Camera");
        URL url=new URL("http://127.0.0.1:4723/wd/hub");
        appium=new AppiumDriver<MobileElement>(url,desire);
        System.out.println("app started");
Run Code Online (Sandbox Code Playgroud)
Error log:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\DELL\\AppData\\Local\\Android\\sdk\\platform-tools\\adb.exe -P 5037 -s …
Run Code Online (Sandbox Code Playgroud)

java android selenium-webdriver appium appium-android

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

org.openqa.selenium.WebDriverException:连接被拒绝:连接

org.openqa.selenium.WebDriverException:连接被拒绝:连接
我正在使用 appium 和 selenium 进行 android 自动化测试 我正在使用 selenium、Gson、appium 和真实设备进行测试,当我执行我的代码时系统向我显示异常可以帮助解决这个问题我从过去两天开始处理问题,但我没有得到任何帮助....appium 服务器正确启动下面是我的环境的描述..

  1. 窗口 7 64
  2. 排除
  3. GSON
  4. Appium [ForWindows_1_4_16_1]
  5. 真机【银河s4】
  6. 朱尼特

    org.openqa.selenium.WebDriverException: Connection refused: connect
    Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:14.666Z'
    System info: host: 'MACPK-WKS-0066', ip: '192.168.8.27', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_161'
    Driver info: driver.version: AndroidDriver
        at io.appium.java_client.remote.AppiumCommandExecutor.lambda$2(AppiumCommandExecutor.java:141)
        at java.util.Optional.orElseGet(Unknown Source)
        at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:140)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
        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:219)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
        at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
        at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
        at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94)
        at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:77) …
    Run Code Online (Sandbox Code Playgroud)

selenium-webdriver appium-android

3
推荐指数
1
解决办法
4508
查看次数

如何在机器人框架Appium中发送返回键?[安卓]

谁能帮助我如何在机器人框架 Appuim Android 中发送返回键?或者我需要使用 python 创建自定义库吗?感谢您

robotframework appium appium-android

3
推荐指数
1
解决办法
3148
查看次数

我收到错误 webdriver:由于未知命令,请求失败,状态为 404

显示错误消息:`错误 webdriver:由于未知命令,请求失败,状态为 404:找不到请求的资源,或者使用映射资源不支持的 HTTP 方法接收请求

错误 webdriver: 未知命令: 找不到请求的资源,或者使用映射资源不支持的 HTTP 方法接收请求

` wdio.conf.js 文件:

**let { join } = require('路径'); Exports.config = { port: 4723, // 默认 appium 端口 services: [ ['appium', { command : 'appium' }] ],

specs: [
    './test/specs/**/*.js'
],

maxInstances: 10,
capabilities: [{
    platformName:'Android',
    platformVersion:'9',
    deviceName:'Pixel',
    app:'D:/test/appium/test2/ApiDemos-debug.apk',   

bail: 0,   
baseUrl: 'http://localhost',    
waitforTimeout: 60000,    
connectionRetryTimeout: 120000,   
connectionRetryCount: 3, 

framework: 'mocha',
Run Code Online (Sandbox Code Playgroud)

}**

package.json 文件: ** {

“名称”:“测试2”,

“版本”:“1.0.0”,

“描述”: ””,

“主要”:“index.js”,

“脚本”:{

"test": "./node_modules/.bin/wdio wdio.conf.js"
Run Code Online (Sandbox Code Playgroud)

},

“关键字”:[],

“作者”: ””, …

android-emulator webdriver-io appium-android

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

XCUI 测试:如何从 iOS 屏幕获取元素列表

我最近开始使用 XCUI 测试设置在 iPhone 真实设备上自动化 iOS 应用程序。

我遇到一个场景,我的应用程序在主页中包含 5 个屏幕,每个屏幕都包含一个唯一的卡号及其余额,因此我必须从屏幕中获取卡号并使用我输入的(预期)卡号进行验证(如果两者都包含)相同,那么我必须单击卡屏幕,否则如果两者不同,那么我必须向右滑动到第二个屏幕并执行相同的过程。

我能够在 Android 中完美地自动化这个场景,因为在 Android 中,每个屏幕都通过唯一的卡号明显区分,但是当我检查 iOS 应用程序上的卡号屏幕时,它显示了附加到应用程序的所有卡列表。在这种情况下,我很难从应用程序获取卡号并使用我输入的卡号进行验证。请参阅下面的代码,该代码已在 Android 上使用

String oysterCardVisibleNumberOnApp= data.get("PrestigeCardNumber");


while(!action.getText(HomePage.oysterCardNumber,"oysterCardNumber").equalsIgnorecase(oysterCardVisibleNumberOnApp))){
      action.swipeRightToLeft();
     }
Run Code Online (Sandbox Code Playgroud)

如果有人知道如何从 iOS 应用程序检索元素/卡片列表,那就太好了,请告诉我。或者如果您知道 XCUI 设置中的任何新方法将帮助我实现这一目标,请告诉我。非常感谢您的帮助:)

请参阅下面的 Android 屏幕和 iOS 屏幕图片以获得更清晰的信息

安卓屏幕

iOS 屏幕

谢谢

java appium-ios appium-android xcuitest

2
推荐指数
1
解决办法
3849
查看次数

语法错误:意外的标记“导出”

我安装了 appium-doctor npm install -g appium-doctor。然后我尝试运行appium-doctor --android以查看任何缺少的 android 依赖项。但是,我收到此错误

.....\AppData\Roaming\nvm\v13.2.0\node_modules\appium-doctor\node_modules\uuid\dist\esm-browser\index.js:1
export { default as v1 } from './v1.js';

SyntaxError: Unexpected token 'export'
^^^^^^
Run Code Online (Sandbox Code Playgroud)

通过谷歌搜索,使用 CommonJS 而不是 ES6 语法的 nodeJS 存在问题,但我不知道如何在命令行上解决此错误。

appium appium-android

2
推荐指数
1
解决办法
4884
查看次数

尝试在 Ubuntu 中安装 opencv4nodejs 时权限被拒绝

我尝试使用以下命令进行安装,我的节点版本opencv4nodejsUbuntu-20.04v12.19.0

\n
sudo npm i -g opencv4nodejs\n
Run Code Online (Sandbox Code Playgroud)\n

但出现这些错误

\n
info install installing opencv version 3.4.6 into directory: /usr/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv\nERR! Error: Command failed: mkdir -p opencv\nmkdir: cannot create directory \xe2\x80\x98opencv\xe2\x80\x99: Permission denied\n \nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! opencv-build@0.1.9 install: `node ./install.js`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the opencv-build@0.1.9 install script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log …
Run Code Online (Sandbox Code Playgroud)

opencv node.js npm appium appium-android

2
推荐指数
1
解决办法
3023
查看次数