简体   繁体   English

Appium无法识别和滚动Android设备上的元素

[英]Appium not able to identify and scroll element on android device

I am trying a piece of appium automation code on the clock app in android but my code tends to skip the scrolling logic.我正在 android 的时钟应用程序上尝试一段 appium 自动化代码,但我的代码倾向于跳过滚动逻辑。 I also tried to findelement() and gettext() to identify the element but still unsuccessful.我也尝试 findelement() 和 gettext() 来识别元素,但仍然不成功。 Following is the code:以下是代码:

package com.test.Clock; 
import org.testng.annotations.Test; 
import io.appium.java_client.AppiumDriver; 
import io.appium.java_client.MobileElement; 
import io.appium.java_client.PerformsTouchActions; 
import io.appium.java_client.TouchAction; 
import io.appium.java_client.android.AndroidDriver; 
import org.testng.annotations.BeforeClass; 
import java.io.BufferedReader; 
import java.io.InputStream; 
import java.io.InputStreamReader; 
import java.net.MalformedURLException; 
import java.net.URL; 
import java.util.HashMap; 
import java.util.concurrent.TimeUnit; 
import org.openqa.selenium.By; 
import org.openqa.selenium.Dimension; 
import org.openqa.selenium.JavascriptExecutor; 
import org.openqa.selenium.NoSuchFrameException; 
import org.openqa.selenium.Point; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.interactions.touch.TouchActions; 
import org.openqa.selenium.remote.DesiredCapabilities; 
import org.openqa.selenium.remote.RemoteWebDriver; 
import org.openqa.selenium.support.ui.WebDriverWait; 
import org.testng.annotations.AfterClass; 

public class Clock { 

static WebDriver driver; 
//static AndroidDriver driver; 

@BeforeClass public void setUp() throws MalformedURLException{ DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("BROWSER_NAME", "Android"); capabilities.setCapability("VERSION", "7.0"); capabilities.setCapability("deviceName","IFZDSCVCKJUWRSOV"); capabilities.setCapability("platformName","Android"); capabilities.setCapability("--session-override",true); capabilities.setCapability("noReset",true); capabilities.setCapability("appPackage", "com.android.deskclock"); capabilities.setCapability("appActivity","com.android.deskclock.AlarmClock"); //driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities); 
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); 
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 
} 

@Test public void testCal() throws InterruptedException { System.out.println("inside test"); 
WebElement createAlarm=driver.findElement(By.id("amigo:id/amigo_icon0")); //WebElement createAlarm=driver.findElement(By.xpath("//android.widget.Button[@text='Create']")); 
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); createAlarm.click(); 
// WebElement plus=driver.findElement(By.id("amigo:id/amigo_numberpicker_input")); //plus.click(); 
// driver.swipe(6, -188, 0, 0, 2); 
try { 
WebElement frame1=driver.findElement(By.id("com.android.deskclock:id/add_alarm_activity_hourNumber")); 
driver.switchTo().frame(frame1);
} 
catch (NoSuchFrameException e) { 
System.out.println(e.getMessage());
} 
Thread.sleep(2000); 
WebElement gettime=driver.findElement(By.id("com.android.deskclock:id/add_alarm_activity_hourNumber")); 
Thread.sleep(2000); 
System.out.println(gettime.getText()); 
JavascriptExecutor js = (JavascriptExecutor) driver; 
HashMap<String, Double> swipeObject = new HashMap<String, Double>(); System.out.println(swipeObject); 
swipeObject.put("startX", 3.0); 
System.out.println(swipeObject); 
swipeObject.put("startY", -183.8); 
System.out.println(swipeObject); 
swipeObject.put("endX", 0.022); 
System.out.println(swipeObject); 
swipeObject.put("endY", 0.02); 
System.out.println(swipeObject); 
swipeObject.put("duration", 2.0); 
//HashMap[] params = { swipeObject }; 
js.executeScript("mobile: scroll", swipeObject); 
System.out.println(js); 
/*JavascriptExecutor js = (JavascriptExecutor) driver; 
HashMap<String, String> scrollObject = new HashMap<String, String>(); scrollObject.put("direction", "up"); 
js.executeScript("mobile: scroll", scrollObject);*/ 
Thread.sleep(2000); 
WebElement equalTo=driver.findElement(By.id("com.android.deskclock:id/add_alarm_save")); equalTo.click(); 
} 
@AfterClass public void teardown(){ 
//close the app driver.quit();
}
}

and following is appium server log:以下是 appium 服务器日志:

Calling AppiumDriver.createSession() with args: [{"--session-override":true,"BROWSER_NAME":"Android","VERSION":"7.0","appActivity":"com.android.deskclock.AlarmClock","appPackage":"com.android.deskclock","deviceName":"IFZDSCVCKJUWRSOV","noReset":true,"platformName":"Android"},null,{"desiredCapabilities":{"--session-override":true,"BROWSER_NAME":"Android","VERSION":"7.0","appActivity":"com.android.deskclock.AlarmClock","appPackage":"com.android.deskclock","deviceName":"IFZDSCVCKJUWRSOV","noReset":true,"platformName":"Android"},"firstMatch":[{"platformName":"android"}]}] [BaseDriver] Event 'newSessionRequested' logged at 1528276642225 (14:47:22 GMT+0530 (India Standard Time)) [Appium] Could not parse W3C capabilities: 'deviceName' can't be blank.使用参数调用 AppiumDriver.createSession(): [{"--session-override":true,"BROWSER_NAME":"Android","VERSION":"7.0","appActivity":"com.android.deskclock.AlarmClock" ,"appPackage":"com.android.deskclock","deviceName":"IFZDSCVCKJUWRSOV","noReset":true,"platformName":"Android"},null,{"desiredCapabilities":{"--session-override ":true,"BROWSER_NAME":"Android","VERSION":"7.0","appActivity":"com.android.deskclock.AlarmClock","appPackage":"com.android.deskclock","deviceName": "IFZDSCVCKJUWRSOV","noReset":true,"platformName":"Android"},"firstMatch":[{"platformName":"android"}]}] [BaseDriver] 事件 'newSessionRequested' 记录在 1528276642225 (14:47) :22 GMT+0530(印度标准时间))[Appium] 无法解析 W3C 功能:“deviceName”不能为空。 Falling back to JSONWP protocol.回退到 JSONWP 协议。 [Appium] The following capabilities were provided in the JSONWP desired capabilities that are missing in W3C capabilities: ["--session-override","BROWSER_NAME","VERSION","appActivity","appPackage","deviceName","noReset","platformName"]. [Appium] W3C 功能中缺少的 JSONWP 所需功能中提供了以下功能:["--session-override","BROWSER_NAME","VERSION","appActivity","appPackage","deviceName"," noReset","平台名称"]。 Falling back to JSONWP protocol.回退到 JSONWP 协议。 [Appium] Creating new AndroidDriver (v2.6.0) session [Appium] Capabilities: [Appium] --session-override: true [Appium] BROWSER_NAME: Android [Appium] VERSION: 7.0 [Appium] appActivity: com.android.deskclock.AlarmClock [Appium] appPackage: com.android.deskclock [Appium] deviceName: IFZDSCVCKJUWRSOV [Appium] noReset: true [Appium] platformName: Android [BaseDriver] Creating session with MJSONWP desired capabilities: {"--session-override":true,... [BaseDriver] The following capabilities were provided, but are not recognized by appium: --session-override, BROWSER_NAME, VERSION. [Appium] 创建新的 AndroidDriver (v2.6.0) 会话 [Appium] 功能:[Appium] --session-override:true [Appium] BROWSER_NAME:Android [Appium] VERSION:7.0 [Appium] appActivity:com.android.deskclock。 AlarmClock [Appium] appPackage: com.android.deskclock [Appium] deviceName: IFZDSCVCKJUWRSOV [Appium] noReset: true [Appium] platformName: Android [BaseDriver] 使用 MJSONWP 所需功能创建会话:{"--session-override":true, ... [BaseDriver] 提供了以下功能,但 appium 无法识别:--session-override、BROWSER_NAME、VERSION。 [BaseDriver] Session created with session id: 7118f268-78fb-4b3e-91fa-f46f119d6dba [AndroidDriver] Getting Java version [AndroidDriver] Java version is: 1.8.0_101 [ADB] Checking whether adb is present [ADB] Using adb.exe from C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe [AndroidDriver] Retrieving device list [ADB] Trying to find a connected android device [ADB] Getting connected devices... [ADB] 1 device(s) connected [AndroidDriver] Using device: IFZDSCVCKJUWRSOV [ADB] Checking whether adb is present [ADB] Using adb.exe from C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe [ADB] Setting device id to IFZDSCVCKJUWRSOV [AndroidDriver] App file was not listed, instead we're going to run com.android.deskclock directly on the device [AndroidDriver] Checking whether package is present on the device [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCV [BaseDriver] Session created with session id: 7118f268-78fb-4b3e-91fa-f46f119d6dba [AndroidDriver] 获取 Java 版本 [AndroidDriver] Java 版本是:1.8.0_101 [ADB] 检查 adb 是否存在 [ADB] Using adb.exe from C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe [AndroidDriver] 正在检索设备列表 [ADB] 正在尝试查找已连接的 android 设备 [ADB] 正在获取已连接的设备... [ADB] 1 个设备已连接 [AndroidDriver] 使用设备:IFZDSCVCKJUWRSOV [ADB] 检查 adb 是否存在 [ADB] 使用来自 C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb 的 adb.exe。 exe [ADB] 将设备 ID 设置为 IFZDSCVCKJUWRSOV [AndroidDriver] 未列出应用程序文件,而是直接在设备上运行 com.android.deskclock [AndroidDriver] 检查设备上是否存在包 [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB] 正在运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCV CKJUWRSOV shell pm list packages com.android.deskclock' [AndroidDriver] Starting Android session [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV wait-for-device' [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell echo ping' [AndroidDriver] Pushing settings apk to device... [ADB] Getting install status for io.appium.settings [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell pm list packages io.appium.settings' [ADB] App is installed [ADB] Getting package info for 'io.appium.settings' [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell dumpsys package io.app CKJUWRSOV shell pm list packages com.android.deskclock' [AndroidDriver] 启动 Android 会话 [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV等待设备' [ADB] 正在连接设备... [ADB] 已连接 1 个设备 [ADB] 正在运行“C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb。 exe -P 5037 -s IFZDSCVCKJUWRSOV shell echo ping' [AndroidDriver] 将设置 apk 推送到设备... [ADB] 获取 io.appium.settings 的安装状态 [ADB] 获取连接的设备... [ADB] 1 个设备) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell pm list packages io.appium.settings' [ADB] App is已安装 [ADB] 正在获取“io.appium.settings”的包信息 [ADB] 正在连接设备... [ADB] 已连接 1 个设备 [ADB] 正在运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android \\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell dumpsys package io.app ium.settings' [ADB] Checking whether aapt is present [ADB] Using aapt.exe from C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\build-tools\\28.0.0-rc2\\aapt.exe [ADB] The installed 'io.appium.settings' package does not require upgrade ('2.3.0' >= '2.3.0') [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell ps' [AndroidDriver] io.appium.settings is already running. ium.settings' [ADB] 检查是否存在 aapt [ADB] 使用来自 C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\build-tools\\28.0.0-rc2\\aapt.exe 的 aapt.exe [ADB ] 安装的 'io.appium.settings' 包不需要升级 ('2.3.0' >= '2.3.0') [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB]运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell ps' [AndroidDriver] io.appium.settings 已经在运行。 There is no need to reset its permissions.无需重置其权限。 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell getprop ro.build.version.sdk' [ADB] Current device property 'ro.build.version.sdk': 24 [ADB] Device API level: 24 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell appops set io.appium.settings android:mock_location allow' [AndroidDriver] setDeviceLanguageCountry requires language or country. [ADB] 正在连接设备... [ADB] 已连接 1 个设备 [ADB] 正在运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell getprop ro.build.version.sdk' [ADB] 当前设备属性 'ro.build.version.sdk': 24 [ADB] 设备 API 级别:24 [ADB] 获取连接的设备... [ADB] 1 个设备(s) 已连接 [ADB] 运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell appops set io.appium.settings android:mock_location allow' [AndroidDriver] setDeviceLanguageCountry 需要语言或国家。 [AndroidDriver] Got language: 'undefined' and country: 'undefined' [Logcat] Starting logcat capture [AndroidDriver] Pushing unlock helper app to device... [ADB] Getting install status for io.appium.unlock [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell pm list packages io.appium.unlock' [ADB] App is installed [ADB] Getting package info for 'io.appium.unlock' [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell dumpsys package io.appium.unlock' [ADB] Checking whether aapt is present [ADB] Using aapt.exe from C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\build-tools\\28.0.0-rc2\\aapt.exe [ADB] The installed 'io.appium.unlock' package does not require upgrade ('2.0.0' >= '2.0.0') [ADB] Getting device platform version [ADB] Getting connected devic [AndroidDriver] 得到语言:'undefined' 和国家:'undefined' [Logcat] 开始 logcat 捕获 [AndroidDriver] 推送解锁助手应用到设备... [ADB] 获取 io.appium.unlock 的安装状态 [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB] 正在运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell pm list packages io.appium.unlock' [ADB] 应用程序已安装 [ADB] 正在获取“io.appium.unlock”的包信息 [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB] 正在运行 'C :\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell dumpsys package io.appium.unlock' [ADB] 检查是否存在 aapt [ADB] 使用 aapt。 exe from C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\build-tools\\28.0.0-rc2\\aapt.exe [ADB] 安装的'io.appium.unlock'包不需要升级('2.0 .0' >= '2.0.0') [ADB] 获取设备平台版本 [ADB] 获取连接的设备es... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 7.0 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell wm size' [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell getprop ro.product.model' [ADB] Current device property 'ro.product.model': S6s [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell getprop ro.product.manufacturer' [ADB] Current device property 'ro.product.manufacturer': GIONEE [AndroidDriver] No app sent in, not par es... [ADB] 1 个设备已连接 [ADB] 正在运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell getprop ro。 build.version.release' [ADB] 当前设备属性 'ro.build.version.release': 7.0 [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB] 正在运行 'C:\\Users \\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell wm size' [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB] 正在运行'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell getprop ro.product.model' [ADB] 当前设备属性 'ro.product.model' : S6s [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB] 正在运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell getprop ro.product.manufacturer' [ADB] 当前设备属性 'ro.product.manufacturer': GIONEE [AndroidDriver] 未发送应用程序,不符合标准sing package/activity [AndroidDriver] No app capability.唱包/活动 [AndroidDriver] 没有应用程序功能。 Assuming it is already on the device [AndroidBootstrap] Watching for bootstrap disconnect [ADB] Forwarding system: 4724 to device: 4724 [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV forward tcp:4724 tcp:4724' [UiAutomator] Starting UiAutomator [UiAutomator] Moving to state 'starting' [UiAutomator] Parsing uiautomator jar [UiAutomator] Found jar name: 'AppiumBootstrap.jar' [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV push 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\appium-android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar' /data/local/tmp/' [ADB] Attempting to kill all uiautomator processes [ADB] Getting all processes with uiautomator [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell ps' [ADB] No uiautomator process found to假设它已经在设备上 [AndroidBootstrap] 正在监视引导程序断开连接 [ADB] 转发系统:4724 到设备:4724 [ADB] 运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb .exe -P 5037 -s IFZDSCVCKJUWRSOV forward tcp:4724 tcp:4724' [UiAutomator] 启动 UiAutomator [UiAutomator] 移动到状态 'starting' [UiAutomator] 解析 uiautomator jar [UiAutomator] 发现 AppjarotA ] 运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV push 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\ appium-android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar' /data/local/tmp/' [ADB] 试图杀死所有 uiautomator 进程 [ADB] 使用 uiautomator 获取所有进程 [ADB] 获取连接的设备... [ADB] ] 1 个设备已连接 [ADB] 运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell ps' [ADB] 未找到 uiautomator 进程到 kill, continuing... [UiAutomator] Starting UIAutomator [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","IFZDSCVCKJUWRSOV","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.android.deskclock","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false] [UiAutomator] Moving to state 'online' [AndroidBootstrap] Android bootstrap socket is now connected [ADB] Getting connected devices... [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.杀死,继续... [UiAutomator] 正在启动 UIAutomator [ADB] 使用参数创建 ADB 子进程:["-P",5037,"-s","IFZDSCVCKJUWRSOV","shell","uiautomator","runtest"," AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.android.deskclock","-e","disableAndroidWatchers",false, "-e","acceptSslCerts",false] [UiAutomator] 移动到状态 'online' [AndroidBootstrap] Android 引导套接字现已连接 [ADB] 正在连接设备... [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 注册崩溃观察者。 [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell dumpsys window' [AndroidDriver] Screen already unlocked, doing nothing [ADB] Device API level: 24 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell am start -W -n com.android.deskclock/com.android.deskclock.AlarmClock -S' [Appium] New AndroidDriver session created successfully, session 7118f268-78fb-4b3e-91fa-f46f119d6dba added to master session list [BaseDriver] Event 'newSessionStarted' logged at 1528276661138 (14:47:41 GMT+0530 (India Standard Time)) [W3C] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true, [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected [ADB] 1 个设备连接 [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell dumpsys window' [AndroidDriver] 屏幕已经解锁,什么都不做 [ADB] 设备 API 级别:24 [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB] 正在运行 'C: \\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell am start -W -n com.android.deskclock/com.android.deskclock.AlarmClock -S' [ Appium] 新的 AndroidDriver 会话创建成功,会话 7118f268-78fb-4b3e-91fa-f46f119d6dba 添加到主会话列表 [BaseDriver] 事件“newSessionStarted”记录在 1528276661138 (14:47:41 GMT+05330) [印度标准时间] ] 用 driver.createSession() 结果响应客户端:{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true , "locationContextEnabled":false,"warnings":{},"desired":{"--session-override":true,"BROWSER_NAME":"Android","VERSION":"7.0","appActivity":"com.android.deskclock.AlarmClock","appPackage":"com.android.deskclock","deviceName":"IFZDSCVCKJUWRSOV","noReset":true,"platformName":"Android"},"--session-override":true,"BROWSER_NAME":"Android","VERSION":"7.0","appActivity":"com.android.deskclock.AlarmClock","appPackage":"com.android.deskclock","deviceName":"IFZDSCVCKJUWRSOV","noReset":true,"platformName":"Android","deviceUDID":"IFZDSCVCKJUWRSOV","platformVersion":"7.0","deviceScreenSize":"1080x1920","deviceModel":"S6s","deviceManufacturer":"GIONEE"} [HTTP] <-- POST /wd/hub/session 200 18916 ms - 866 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/timeouts [HTTP] {"type":"implicit","ms":15000} [W3C] Bad parameters: BadParametersError: Parameters were incorrect. "locationContextEnabled":false,"warnings":{},"desired":{"--session-override":true,"BROWSER_NAME":"Android","VERSION":"7.0","appActivity":"com .android.deskclock.AlarmClock","appPackage":"com.android.deskclock","deviceName":"IFZDSCVCKJUWRSOV","noReset":true,"platformName":"Android"},"--session-override" :true,"BROWSER_NAME":"Android","VERSION":"7.0","appActivity":"com.android.deskclock.AlarmClock","appPackage":"com.android.deskclock","deviceName":" IFZDSCVCKJUWRSOV","noReset":true,"platformName":"Android","deviceUDID":"IFZDSCVCKJUWRSOV","platformVersion":"7.0","deviceScreenSize":"1080x1920","deviceModel":"S6s"," deviceManufacturer":"GIONEE"} [HTTP] <-- POST /wd/hub/session 200 18916 ms - 866 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa- f46f119d6dba/timeouts [HTTP] {"type":"implicit","ms":15000} [W3C] 错误参数:BadParametersError:参数不正确。 We wanted "W3C protocol expects any of script, pageLoad or implicit to be set" and you sent {"type":"implicit","ms":15000} [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/timeouts 400 3 ms - 5166 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element [HTTP] {"using":"id","value":"amigo:id/amigo_icon0"} [W3C] Calling AppiumDriver.findElement() with args: ["id","amigo:id/amigo_icon0","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"amigo:id/amigo_icon0","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"amigo:id/amigo_icon0","context":"","multiple":false}} [我们想要“W3C 协议需要设置任何脚本、页面加载或隐式”,并且您发送了 {"type":"implicit","ms":15000} [HTTP] <-- POST /wd/hub/session/7118f268 -78fb-4b3e-91fa-f46f119d6dba/timeouts 400 3 ms - 5166 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba" :"id","value":"amigo:id/amigo_icon0"} [W3C] 使用参数调用 AppiumDriver.findElement(): ["id","amigo:id/amigo_icon0","7118f268-78fb-4b3e-91fa -f46f119d6dba"] [BaseDriver] 此请求的有效定位器策略:xpath、id、类名、可访问性 id、-android uiautomator [BaseDriver] 等待 0 毫秒条件 [AndroidBootstrap] 向 android 发送命令:{"cmd": "action","action":"find","params":{"strategy":"id","selector":"amigo:id/amigo_icon0","context":"","multiple":false} } [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 从客户端得到数据:{"cmd":"action","action":"find","params":{"strategy":"id","selector": "amigo:id/amigo_icon0","context":"","multiple":false}} [ AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'amigo:id/amigo_icon0' using 'ID' with the contextId: '' multiple: false [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=amigo:id/amigo_icon0] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}} [AndroidBootstrap] Received command result from bootstrap [W3C] Responding to client with driver.findElement() result: {"ELEMENT":"1"} [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element 200 1496 ms - 87 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/timeouts [HTTP] {"type":"implicit","ms":3000} [W3C] Bad parameters: BadParametersError: Parameters were incorrect. AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到了 ACTION 类型的命令 [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到了命令动作:find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 使用 'ID 查找'amigo:id/amigo_icon0' ' with the contextId: '' multiple: false [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=amigo:id/amigo_icon0] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 返回结果:{ "status":0,"value":{"ELEMENT":"1"}} [AndroidBootstrap] 从引导程序接收命令结果 [W3C] 使用 driver.findElement() 结果响应客户端:{"ELEMENT":"1" } [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element 200 1496 ms - 87 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268- 78fb-4b3e-91fa-f46f119d6dba/timeouts [HTTP] {"type":"implicit","ms":3000} [W3C] 错误参数:BadParametersError:参数不正确。 We wanted "W3C protocol expects any of script, pageLoad or implicit to be set" and you sent {"type":"implicit","ms":3000} [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/timeouts 400 2 ms - 5164 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/1/click [HTTP] {"id":"1"} [W3C] Calling AppiumDriver.click() with args: ["1","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"1"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true} [AndroidBootstrap] Received command result from bootstrap [W3C] Responding to client with driver.click() re我们想要“W3C 协议需要设置任何脚本、页面加载或隐式”,并且您发送了 {"type":"implicit","ms":3000} [HTTP] <-- POST /wd/hub/session/7118f268 -78fb-4b3e-91fa-f46f119d6dba/timeouts 400 2 ms - 5164 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d16dba {"id":"1"} [W3C] 使用参数调用 AppiumDriver.click(): ["1","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [AndroidBootstrap] 向 android 发送命令:{"cmd" :"action","action":"element:click","params":{"elementId":"1"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 从客户端获取数据:{"cmd":" action","action":"element:click","params":{"elementId":"1"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到了 ACTION 类型的命令 [AndroidBootstrap] [BOOTSTRAP LOG] [ debug] Got command action: click [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true} [AndroidBootstrap] Received command result from bootstrap [W3C] 用驱动响应客户端。点击()重新sult: true [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/1/click 200 350 ms - 76 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element [HTTP] {"using":"id","value":"com.android.deskclock:id/add_alarm_activity_hourNumber"} [W3C] Calling AppiumDriver.findElement() with args: ["id","com.android.deskclock:id/add_alarm_activity_hourNumber","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.deskclock:id/add_alarm_activity_hourNumber","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.deskclock:id/add_alarm_activity_hourNumber","c sult: true [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/1/click 200 350 ms - 76 [HTTP] [HTTP] --> POST /wd/ hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element [HTTP] {"using":"id","value":"com.android.deskclock:id/add_alarm_activity_hourNumber"} [W3C] 调用 AppiumDriver.findElement () with args: ["id","com.android.deskclock:id/add_alarm_activity_hourNumber","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] 此请求的有效定位器策略:xpath, id, class name , 可访问性 id, -android uiautomator [BaseDriver] 等待条件 [AndroidBootstrap] 最多 0 毫秒 向 android 发送命令:{"cmd":"action","action":"find","params":{"strategy" :"id","selector":"com.android.deskclock:id/add_alarm_activity_hourNumber","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 从客户端得到数据: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.deskclock:id/add_alarm_activity_hourNumber","c ontext":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.deskclock:id/add_alarm_activity_hourNumber' using 'ID' with the contextId: '' multiple: false [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.android.deskclock:id/add_alarm_activity_hourNumber] [AndroidBootstrap] Received command result from bootstrap [W3C] Responding to client with driver.findElement() result: {"ELEMENT":"2"} [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element 200 1884 ms - 87 [HTTP] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"2"}} [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/frame [HTTP] {"id":{"ELEMENT":"2","element-6066-11e4-a52e-4f735466cecf":"2"}} [W3C] Calling AppiumDriver.setFrame() with args: [{" ontext":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到了 ACTION 类型的命令 [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到了命令动作:find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 使用 'ID' 和 contextId 查找 'com.android.deskclock:id/add_alarm_activity_hourNumber':'' multiple: false [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 使用:UiSelector[INSTANCE=0, RESOURCE_ID=com。 android.deskclock:id/add_alarm_activity_hourNumber] [AndroidBootstrap] 从 bootstrap 接收命令结果 [W3C] 使用 driver.findElement() 结果响应客户端:{"ELEMENT":"2"} [HTTP] <-- POST /wd/hub /session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element 200 1884 ms - 87 [HTTP] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 返回结果:{"status":0,"value":{"ELEMENT" :"2"}} [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/frame [HTTP] {"id":{"ELEMENT":"2","element -6066-11e4-a52e-4f735466cecf":"2"}} [W3C] 使用参数调用 AppiumDriver.setFrame():[{" ELEMENT":"2","element-6066-11e4-a52e-4f735466cecf":"2"},"7118f268-78fb-4b3e-91fa-f46f119d6dba"] [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/frame 404 2 ms - 3078 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element [HTTP] {"using":"id","value":"com.android.deskclock:id/add_alarm_activity_hourNumber"} [W3C] Calling AppiumDriver.findElement() with args: ["id","com.android.deskclock:id/add_alarm_activity_hourNumber","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.deskclock:id/add_alarm_activity_hourNumber","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy": ELEMENT":"2","element-6066-11e4-a52e-4f735466cecf":"2"},"7118f268-78fb-4b3e-91fa-f46f119d6dba"] [HTTP] <-- POSTsession /wd/hub/ 7118f268-78fb-4b3e-91fa-f46f119d6dba/frame 404 2 ms - 3078 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46fing [HTTPelement] ":"id","value":"com.android.deskclock:id/add_alarm_activity_hourNumber"} [W3C] 使用参数调用 AppiumDriver.findElement():["id","com.android.deskclock:id/add_alarm_activity_hourNumber" ,"7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] 此请求的有效定位器策略:xpath、id、类名、可访问性 id、-android uiautomator [BaseDriver] 等待条件 [AndroidBootstrap] 发送最多 0 毫秒命令 android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.deskclock:id/add_alarm_activity_hourNumber", "context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 从客户端获取数据:{"cmd":"action","action":"find","params": {“战略”: "id","selector":"com.android.deskclock:id/add_alarm_activity_hourNumber","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.deskclock:id/add_alarm_activity_hourNumber' using 'ID' with the contextId: '' multiple: false [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.android.deskclock:id/add_alarm_activity_hourNumber] [AndroidBootstrap] Received command result from bootstrap [W3C] Responding to client with driver.findElement() result: {"ELEMENT":"3"} [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element 200 21 ms - 87 [HTTP] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"3"}} [HTTP] --> GET /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/3/text [HTTP] {} [W3C] Calling AppiumDriver.getTex "id","selector":"com.android.deskclock:id/add_alarm_activity_hourNumber","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到了 ACTION 类型的命令 [ AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到命令操作:find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 使用 'ID' 和 contextId 查找'com.android.deskclock:id/add_alarm_activity_hourNumber':'' multiple: false [ AndroidBootstrap] [BOOTSTRAP LOG] [debug] 使用:UiSelector[INSTANCE=0, RESOURCE_ID=com.android.deskclock:id/add_alarm_activity_hourNumber] [AndroidBootstrap] 从 bootstrap 接收命令结果 [W3C] 使用 driver.findElement() 结果响应客户端: {"ELEMENT":"3"} [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element 200 21 ms - 87 [HTTP] [AndroidBootstrap] [BOOTSTRAP LOG] [调试] 返回结果:{"status":0,"value":{"ELEMENT":"3"}} [HTTP] --> GET /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba /element/3/text [HTTP] {} [W3C] 调用 AppiumDriver.getTex t() with args: ["3","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getText","params":{"elementId":"3"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getText","params":{"elementId":"3"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getText [AndroidBootstrap] Received command result from bootstrap [W3C] Responding to client with driver.getText() result: "" [HTTP] <-- GET /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/3/text 200 24 ms - 74 [HTTP] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":""} [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/execute [HTTP] {"script":"mobile: scroll","args":[{"duration":2,"endY":0.02,"endX":0.022,"startY":-183.8,"startX":3}]} [W3C] Calling AppiumDriver.execute() with args: [ t() with args: ["3","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [AndroidBootstrap] 向 android 发送命令:{"cmd":"action","action":"element:getText", "params":{"elementId":"3"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 从客户端获取数据:{"cmd":"action","action":"element:getText","params ":{"elementId":"3"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到了 ACTION 类型的命令 [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到了命令动作:getText [AndroidBootstrap] 从引导程序接收到的命令结果[W3C] 使用 driver.getText() 结果响应客户端:"" [HTTP] <-- GET /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/3/text 200 24 ms - 74 [HTTP] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 返回结果:{"status":0,"value":""} [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e- 91fa-f46f119d6dba/execute [HTTP] {"script":"mobile: scroll","args":[{"duration":2,"endY":0.02,"endX":0.022,"startY":-183.8, "startX":3}]} [W3C] 使用参数调用 AppiumDriver.execute():[ "mobile: scroll",[{"duration":2,"endY":0.02,"endX":0.022,"startY":-183.8,"startX":3}],"7118f268-78fb-4b3e-91fa-f46f119d6dba"] [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/execute 404 4 ms - 5796 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element [HTTP] {"using":"id","value":"com.android.deskclock:id/add_alarm_save"} [W3C] Calling AppiumDriver.findElement() with args: ["id","com.android.deskclock:id/add_alarm_save","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.deskclock:id/add_alarm_save","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selecto "移动:滚动",[{"duration":2,"endY":0.02,"endX":0.022,"startY":-183.8,"startX":3}],"7118f268-78fb-4b3e-91fa- f46f119d6dba"] [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/execute 404 4 ms - 5796 [HTTP] [HTTP] --> POST/wd/hub 7118f268-78fb-4b3e-91fa-f46f119d6dba/element [HTTP] {"using":"id","value":"com.android.deskclock:id/add_alarm_save"} [W3C] 使用参数调用 AppiumDriver.findElement() : ["id","com.android.deskclock:id/add_alarm_save","7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] 此请求的有效定位器策略:xpath、id、类名、可访问性 id、 -android uiautomator [BaseDriver] 等待 0 毫秒的条件 [AndroidBootstrap] 向 android 发送命令:{"cmd":"action","action":"find","params":{"strategy":"id" ,"selector":"com.android.deskclock:id/add_alarm_save","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 从客户端获取数据:{"cmd" :"action","action":"find","params":{"strategy":"id","selecto r":"com.android.deskclock:id/add_alarm_save","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.deskclock:id/add_alarm_save' using 'ID' with the contextId: '' multiple: false [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.android.deskclock:id/add_alarm_save] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"4"}} [AndroidBootstrap] Received command result from bootstrap [W3C] Responding to client with driver.findElement() result: {"ELEMENT":"4"} [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element 200 28 ms - 87 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/4/click [HTTP] {"id":"4"} [W3C] Calling AppiumDriver.click() with args: ["4","7118f268-78fb-4b3e-91fa-f46f1 r":"com.android.deskclock:id/add_alarm_save","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 得到动作类型的命令 [AndroidBootstrap] [BOOTSTRAP LOG ] [debug] 得到命令操作:find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 使用 'ID' 和 contextId 查找'com.android.deskclock:id/add_alarm_save':'' multiple: false [AndroidBootstrap] [BOOTSTRAP LOG] ] [调试] 使用:UiSelector[INSTANCE=0, RESOURCE_ID=com.android.deskclock:id/add_alarm_save] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] 返回结果:{"status":0,"value":{" ELEMENT":"4"}} [AndroidBootstrap] 从 bootstrap 接收命令结果 [W3C] 使用 driver.findElement() 结果响应客户端:{"ELEMENT":"4"} [HTTP] <-- POST /wd/hub /session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element 200 28 ms - 87 [HTTP] [HTTP] --> POST /wd/hub/session/7118f268-78fb-4b3e-91fa-9d4f6e单击 [HTTP] {"id":"4"} [W3C] 使用参数调用 AppiumDriver.click():["4","7118f268-78fb-4b3e-91fa-f46f1 19d6dba"] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"4"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"4"}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true} [AndroidBootstrap] Received command result from bootstrap [W3C] Responding to client with driver.click() result: true [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/4/click 200 355 ms - 76 [HTTP] [HTTP] --> DELETE /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba [HTTP] {} [W3C] Calling AppiumDriver.deleteSession() with args: ["7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] Event 'quitSessionRequested' logged at 1528276671521 (14:47:51 GMT+0530 (India Standard Time)) [App 19d6dba"] [AndroidBootstrap] 向 android 发送命令:{"cmd":"action","action":"element:click","params":{"elementId":"4"}} [AndroidBootstrap] [BOOTSTRAP LOG ] [debug] 从客户端得到数据:{"cmd":"action","action":"element:click","params":{"elementId":"4"}} [AndroidBootstrap] [BOOTSTRAP LOG] [ debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action:点击[AndroidBootstrap] [BOOTSTRAP LOG] [debug] 返回结果:{"status":0,"value":true} [AndroidBootstrap ] 从引导程序收到的命令结果 [W3C] 使用 driver.click() 结果响应客户端:true [HTTP] <-- POST /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba/element/4/click 200 355 ms - 76 [HTTP] [HTTP] --> DELETE /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba [HTTP] {} [W3C] 使用参数调用 AppiumDriver.deleteSession():“ 7118f268-78fb-4b3e-91fa-f46f119d6dba"] [BaseDriver] 事件 'quitSessionRequested' 记录在 1528276671521 (14:47:51 GMT+0530 (India Standard Time)) [App ium] Removing session 7118f268-78fb-4b3e-91fa-f46f119d6dba from our master session list [AndroidDriver] Shutting down Android driver [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell am force-stop com.android.deskclock' [ADB] Pressing the HOME button [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell input keyevent 3' [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"} [AndroidBootstrap] Received command result from bootstrap [UiAutomator] Shutting down UiAutomator [UiAutomator] Moving to state 'stopping' [UiAutomator] UiAutomator shut down normally [UiAutomator] Moving to state 'stopped' [ADB] Attempting to kill all uiautomator processes [A ium] 从我们的主会话列表中删除会话 7118f268-78fb-4b3e-91fa-f46f119d6dba [AndroidDriver] 正在关闭 Android 驱动程序 [ADB] 正在连接设备... [ADB] 1 个设备已连接 [ADB] 正在运行 'C: \\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell am force-stop com.android.deskclock' [ADB] Press the HOME button [ADB] 获取连接的设备... [ADB] 1 个设备已连接 [ADB] 正在运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell input keyevent 3' [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"} [AndroidBootstrap] Received command result from bootstrap [ UiAutomator] 正在关闭 UiAutomator [UiAutomator] 进入“停止”状态 [UiAutomator] UiAutomator 正常关闭 [UiAutomator] 进入“停止”状态 [ADB] 试图杀死所有 uiautomator 进程 [A] DB] Getting all processes with uiautomator [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell ps' [ADB] No uiautomator process found to kill, continuing... [UiAutomator] Moving to state 'stopped' [Logcat] Stopping logcat capture [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\\Users{Username ![screenshot for app] 1 }\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell am force-stop io.appium.unlock' [AndroidDriver] Not cleaning generated files. DB] 使用 uiautomator 获取所有进程 [ADB] 获取连接的设备... [ADB] 1 个连接的设备 [ADB] 运行 'C:\\Users\\PAKALI\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb .exe -P 5037 -s IFZDSCVCKJUWRSOV shell ps' [ADB] 没有找到要杀死的 uiautomator 进程,继续... [UiAutomator] 移动到状态 'stopped' [Logcat] 停止 logcat 捕获 [ADB] 正在连接设备... [ ADB] 1 个设备已连接 [ADB] 运行 'C:\\Users{用户名![应用程序的屏幕截图] 1 }\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s IFZDSCVCKJUWRSOV shell am force-stop io.appium.unlock' [AndroidDriver] 不清理生成的文件。 Add clearSystemFiles capability if wanted.如果需要,添加clearSystemFiles功能。 [BaseDriver] Event 'quitSessionFinished' logged at 1528276676716 (14:47:56 GMT+0530 (India Standard Time)) [W3C] Received response: null [W3C] But deleting session, so not returning [W3C] Responding to client with driver.deleteSession() result: null [HTTP] <-- DELETE /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba [BaseDriver] 事件 'quitSessionFinished' 记录在 1528276676716 (14:47:56 GMT+0530 (India Standard Time)) [W3C] 收到响应:null [W3C] 但删除会话,所以不返回 [W3C] 响应客户端与驱动程序.deleteSession() 结果:null [HTTP] <-- DELETE /wd/hub/session/7118f268-78fb-4b3e-91fa-f46f119d6dba

200 5196 ms - 76 200 5196 毫秒 - 76

You are using the wrong library to perform that action, the js.execute("mobile: scroll") is for iOS.您正在使用错误的库来执行该操作,js.execute("mobile: scroll") 适用于 iOS。 You need to look into the TouchAction library.您需要查看 TouchAction 库。 Here is a link to their documentation http://appium.io/docs/en/writing-running-appium/touch-actions/这是他们文档的链接http://appium.io/docs/en/writing-running-appium/touch-actions/

I had some problems with scrolling on an android device via Appium as well.我在通过 Appium 在 android 设备上滚动时也遇到了一些问题。
In my case the main problem was that the scroll action was performed before the fragment I wanted to scroll in was ready.就我而言,主要问题是滚动操作是在我想要滚动的片段准备好之前执行的。

Scenario:设想:

click button to open new fragment -> scroll from y 500 to y 100单击按钮打开新片段 -> 从 y 500 滚动到 y 100

Solution:解决方案:

click button to open new fragment -> wait for a element A of the opened fragment -> scroll from y 500 to y 100 after the element A was found单击按钮打开新片段 -> 等待已打开片段的元素 A -> 找到元素 A 后从 y 500 滚动到 y 100

Code for scrolling(Kotlin):滚动代码(Kotlin):

//wait for some element of the fragment before, then scroll:
PlatformTouchAction(driver as AppiumDriver)
            .press(PointOption.point(100,500))
            .waitAction(WaitOptions.waitOptions(Duration.ofMillis(200)))
            .moveTo(PointOption.point(100,100)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000)))
            .release()
            .perform()

The PlatfromTouchAction is just a wrapper to make TouchAction usable in Kotlin like described in this discussion PlatfromTouchAction 只是一个包装器,使 TouchAction 在 Kotlin 中可用,如本讨论中所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM