Код: Выделить всё
fun swipe(
direction: SwipeDirection,
edgeOffset: Point = Point(200, 200),
) {
val dimension = driver.manage().window().size
val startPoint: Point
val endPoint: Point
when (direction) {
SwipeDirection.Up -> {
startPoint = Point(dimension.width / 2, dimension.height - edgeOffset.y)
endPoint = Point(dimension.width / 2, edgeOffset.y)
}
SwipeDirection.Down -> {
startPoint = Point(dimension.width / 2, edgeOffset.y)
endPoint = Point(dimension.width / 2, dimension.height - edgeOffset.y)
}
SwipeDirection.Right -> {
startPoint = Point(edgeOffset.x, dimension.height / 2)
endPoint = Point(dimension.width - edgeOffset.x, dimension.height / 2)
}
SwipeDirection.Left -> {
startPoint = Point(dimension.width - edgeOffset.x, dimension.height / 2)
endPoint = Point(edgeOffset.x, dimension.height / 2)
}
}
swipe(startPoint, endPoint)
}
fun swipe(
start: Point,
end: Point,
) {
moveByOffset(start.x, start.y)
clickAndHold()
pause(Timeouts.SHORT_TOUCH)
moveByOffset(end.x, end.y)
release()
perform()
}
org.openqa.selenium.InvalidArgumentException: идентификатор действия «палец» имеет один или несколько дубликатов. Информация о сборке: версия: '4.19. 0', редакция: '5f9cec8963' Информация о системе: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.3', java.version: '17.0.9' Информация о драйвере: io .appium.java_client.android.AndroidDriver Команда: [e71a8d51-6b6d-4372-b73e-b427cb0f8cc9, действия {actions=[org.openqa.selenium.interactions.Sequence@f7985c6, org.openqa.selenium.interactions.Sequence@2768d45e] }] Возможности {appium:app: /Users/perrystreet/Document..., appium:appPackage: com.appspot.scruffapp, appium:appWaitForLaunch: false, appium:automationName: UIAutomator2, appium:clearDeviceLogsOnStart: true, appium:databaseEnabled: false, appium: Desired: {app: /Users/perrystreet/Document..., appWaitForLaunch: false, AutomationName: UIAutomator2, ClearDeviceLogsOnStart: true, mjpegServerPort: 56346, NativeWebScreenshot: true, PlatformName: ANDROID}, appium:deviceApiLevel: 34, appium:deviceManufacturer: Google, appium:deviceModel: sdk_gphone64_arm64, appium:deviceName: emulator-5556, appium:deviceScreenDensity: 420, appium:deviceScreenSize: 1080x2400, appium:deviceUDID: emulator-5556, appium:javascriptEnabled: true, appium:locationContext Включено: false, appium:mjpegServerPort: 56346, appium:nativeWebScreenshot: true, appium:networkConnectionEnabled: true, appium:pixelRatio: 2.625, appium:platformVersion: 14, appium:statBarHeight: 128, appium:takesScreenshot: true, appium:viewportRect: {height : 2272, слева: 0, вверху: 128, ширина: 1080}, appium:warnings: {}, appium:webStorageEnabled: false, PlatformName: ANDROID} Идентификатор сеанса: e71a8d51-6b6d-4372-b73e-b427cb0f8cc9 на java.base@ 17.0.9/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(собственный метод) по адресу java.base@17.0.9/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) по адресу java.base@17.0.9/jdk. Internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) по адресу java.base@17.0.9/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) по адресу java.base@17.0.9/java.lang.reflect.Constructor. newInstance(неизвестный источник) в app//org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:167) в app//org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java) :138) в app//org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:50) в app//org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:190 ) в app//io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237) в app//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518) в app//org .openqa.selenium.remote.RemoteWebDriver.perform(RemoteWebDriver.java:604) в приложении //org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:603) в приложении //org.openqa.selenium .interactions.Actions.perform(Actions.java:568) в приложении //support.Actions.swipe(Actions.kt:86)
Я пробовал использовать разные способы действий W3C, но ничего не получилось затем приходите с решением.
Подробнее здесь: https://stackoverflow.com/questions/785 ... or-more-du
Мобильная версия