java-client icon indicating copy to clipboard operation
java-client copied to clipboard

The constructor TouchAction(AndroidDriver) is undefined

Open ChristianErdtmann opened this issue 2 years ago • 1 comments

The problem

Hey i have generated a swipe action by recording over the appium inspector.

I got the folowing code:

        (new TouchAction(driver))
        .press({x: 656, y: 1393})
        .moveTo({x: 437: y: 619})
        .release()
        .perform()

In this case i got the error The constructor TouchAction(AndroidDriver) is undefined

I also tried

        TouchAction ta = new TouchAction(driver);
        PointOption poStart = new PointOption();
        PointOption poEnd = new PointOption();
        poStart.point(656, 1393);
        poEnd.point(437, 619);
        ta.press(poStart).moveTo(poEnd).release().perform();

In this case press, moveTo, release and release are crossed out, same with TouchAction.

At my import io.appium.java_client.TouchAction; the TouchAction is crossed out

driver is AndroidDriver.

Error Log

This is my Error log by trying to execute the secound code snipped

Exception in thread "main" java.lang.IllegalArgumentException: Coordinate values must be defined at io.appium.java_client.touch.offset.PointOption.lambda$verify$0(PointOption.java:65) at java.base/java.util.Optional.orElseThrow(Optional.java:403) at io.appium.java_client.touch.offset.PointOption.verify(PointOption.java:65) at io.appium.java_client.touch.ActionOptions.build(ActionOptions.java:37) at io.appium.java_client.touch.offset.PointOption.build(PointOption.java:71) at io.appium.java_client.TouchAction$ActionParameter.(TouchAction.java:241) at io.appium.java_client.TouchAction.press(TouchAction.java:73)

Environment

I using the newest version of all appium products. Android Emulator java-client-8.0.0 selenium-server 4.1.2

Code To Reproduce Issue [ Good To Have ]

1.Create new Java Projekt in Eclipse add the libs for selenium-server-4.1.2, common-lang.3.1.1.2 and java-client 8.0.0 2. try to add one of the code snippets above -> Code is marked with red and give the error message.

ChristianErdtmann avatar Mar 18 '22 21:03 ChristianErdtmann

looks like the inspector java generation code needs to be updated? (duplicate of https://github.com/appium/appium-inspector/issues/226?)

jlipps avatar Mar 22 '22 20:03 jlipps