51Testing软件测试论坛

标题: Appium 多点触摸报错 [打印本页]

作者: 测试积点老人    时间: 2021-7-2 13:06
标题: Appium 多点触摸报错
代码:
  1. package samoyed;

  2. import java.net.MalformedURLException;
  3. import java.net.URL;
  4. import java.time.Duration;

  5. import org.openqa.selenium.WebElement;
  6. import org.openqa.selenium.remote.DesiredCapabilities;

  7. import io.appium.java_client.MultiTouchAction;
  8. import io.appium.java_client.TouchAction;
  9. import io.appium.java_client.android.AndroidDriver;
  10. import io.appium.java_client.touch.WaitOptions;
  11. import io.appium.java_client.touch.offset.PointOption;

  12. public class Zoom {

  13. public static AndroidDriver ad;

  14. public static void main(String[] args) throws MalformedURLException, InterruptedException {
复制代码
Thread.sleep(13000);MultiTouchAction mta = new MultiTouchAction(ad);TouchAction tA1 = new TouchAction(ad);TouchAction tA2 = new TouchAction(ad);int x = ad.manage().window().getSize().getWidth();int y = ad.manage().window().getSize().getHeight()ointOption S1 = PointOption.point(x*4/10,y*4/10)ointOption D1 = PointOption.point(x*2/10,y*2/10)ointOption S2 = PointOption.point(x*6/10,y*6/10)ointOption D2 = PointOption.point(x*8/10,y*8/10);Duration du = Duration.ofMillis(2000);WaitOptions wo = WaitOptions.waitOptions(du);tA1.press(S1).waitAction(wo).moveTo(D1).release();tA1.press(S2).waitAction(wo).moveTo(D2).release();mta.add(tA1).add(tA2);mta.perform(); }
}

Eclipse 报错:
  1. 十一月 03, 2020 5:16:54 下午 io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0 信息: Detected dialect: OSS
  2. Exception in thread "main" org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot read property 'action' of undefined (WARNING: The server did not provide any stacktrace information)
  3. Command duration or timeout: 0 milliseconds
  4. Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
  5. System info: host: 'T480S-SJFANG', ip: '10.66.40.99', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202-release'
  6. Driver info: io.appium.java_client.android.AndroidDriver
  7. Capabilities {appActivity: com.baidu.baidumaps.Welcome..., appPackage: com.baidu.BaiduMap, automationName: uiautomator2, databaseEnabled: false, desired: {appActivity: com.baidu.baidumaps.Welcome..., appPackage: com.baidu.BaiduMap, automationName: uiautomator2, deviceName: 127.0.0.1:62001, noReset: true, platformName: Android}, deviceApiLevel: 22, deviceManufacturer: OPPO, deviceModel: OPPO R11, deviceName: 127.0.0.1:62001, deviceScreenDensity: 240, deviceScreenSize: 720x1280, deviceUDID: 127.0.0.1:62001, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, pixelRatio: 1.5, platform: LINUX, platformName: Android, platformVersion: 5.1.1, statBarHeight: 38, takesScreenshot: true, viewportRect: {height: 1242, left: 0, top: 38, width: 720}, warnings: {}, webStorageEnabled: false}
  8. Session ID: 64fb9c2b-550d-4f2c-ae07-2a1ffebe2e98
  9. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  10. at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  11. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  12. at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  13. at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
  14. at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
  15. at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
  16. at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
  17. at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
  18. at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
  19. at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
  20. at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
  21. at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
  22. at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
  23. at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
  24. at io.appium.java_client.PerformsTouchActions.performMultiTouchAction(PerformsTouchActions.java:58)
  25. at io.appium.java_client.MultiTouchAction.perform(MultiTouchAction.java:74)
  26. at samoyed.Zoom.Zoom(Zoom.java:61)
  27. at samoyed.Zoom.main(Zoom.java:32)

  28. Appium 报错:

  29. [MJSONWP (64fb9c2b)] Encountered internal error running command: TypeError: Cannot read property 'action' of undefined

  30. **[MJSONWP (64fb9c2b)] at AndroidUiautomator2Driver.parseTouch (C:\Users\sjfang\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\lib\commands\touch.js:194:16)

  31. **[MJSONWP (64fb9c2b)] at parseTouch (C:\Users\sjfang\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\lib\commands\touch.js:292:23)

  32. **[MJSONWP (64fb9c2b)] at mapper (C:\Users\sjfang\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\asyncbox\lib\asyncbox.js:79:24)

  33. **[HTTP] <-- POST /wd/hub/session/64fb9c2b-550d-4f2c-ae07-2a1ffebe2e98/touch/multi/perform 500 4 ms - 213
复制代码



作者: 海海豚    时间: 2021-7-5 09:15
http://testingpai.com/article/1604395677888  参考下
作者: 郭小贱    时间: 2021-7-5 09:34
Cannot read property 'action' of undefined
作者: qqq911    时间: 2021-7-5 10:59
换个版本试试
作者: bellas    时间: 2021-7-5 12:13
换个版本试试
作者: bellas    时间: 2021-7-5 12:15
换个版本试试
作者: litingting0214    时间: 2021-7-5 14:57
http://testingpai.com/article/1604395677888 参考下这篇文章




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2