首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何解决Appium无法在Android设备上识别和滚动元素的问题?

如何解决Appium无法在Android设备上识别和滚动元素的问题?
EN

Stack Overflow用户
提问于 2018-07-26 00:22:31
回答 1查看 0关注 0票数 0

我想用findelement()和gettext()来标识元素,但没有成功,以下是我的代码:

代码语言:txt
复制
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:

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. Falling back to JSONWP protocol. [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"]. Falling back to JSONWP protocol. [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. [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 IFZDSCVCKJUWRSOV 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.appium.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. 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. [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 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.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 parsing package/activity [AndroidDriver] No app capability. 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 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. [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,"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. 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}} [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. 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() result: 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","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":"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: [{"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":"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.getText() 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: ["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","selector":"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-f46f119d6dba"] [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)) [Appium] 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 [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 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. Add clearSystemFiles capability if wanted. [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 200 5196 ms - 76

EN

回答 1

Stack Overflow用户

发布于 2018-07-26 10:20:42

你用错误的库来执行该操作,js.Execute(“Mobile:SCILLE”)是用于IOS的

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100005766

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档