Appium 新手。它的 Inspector(GUI 版本)对应用程序图像的任何点击都没有响应(服务器上没有日志,点击后也没有 App Source 内容)。如果点击“Tap By Coordinates”,它只会在服务器上生成日志。我尝试了 appium-desktop-Setup-1.0.2-beta2.exe 和 appium-desktop-web-setup-1.6.2.exe (v1.8.1),结果是一样的。
实际使用的测试手机是Moto X Sprint (Android 4.2.2) 日志开头复制如下,加上代码。
[Appium] Welcome to Appium v1.8.1
[Appium] Non-default server args:
[Appium] sessionOverride: true
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[MJSONWP] Calling AppiumDriver.getSessions() with args: []
[MJSONWP] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 2 ms - 40
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":"com.android.vending.AssetBrowserActivity","appPackage":"com.android.vending","deviceName":"My Phone", ... ...
………………
//我的代码
package tests;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
public class AppiumTest {
public static void main(String[] args) {
//Set the Desired Capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My Phone");
caps.setCapability("udid", "LXSZ2A0007"); //Give Device ID of your mobile phone
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "4.2.2");
caps.setCapability("appPackage", "com.android.vending");
caps.setCapability("appActivity", "com.android.vending.AssetBrowserActivity");
caps.setCapability("noReset", "true");
//Instantiate Appium Driver
try {
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), caps);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
}
}
请注意,它指向顶部的“Google Play”(请参见下面的屏幕截图)。无论我在图像上指向哪里都没有反应。