Interacting with TouchActions with coordiantes

while performing TouchActions I got this exceptions

  1. Failed to initialize Appium session: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’

  2. org.openqa.selenium.UnsupportedCommandException:

this is my code appiumDriver.findElement(By.xpath(“//*[contains(@bounds, "[0,102][1080,2400]")]\n”
+ “”)).click();
Thread.sleep(3000);

		new TouchAction<>(appiumDriver)
		.tap(PointOption.point(673, 1526))
		.release()
		.perform();

=> can you guys know how to resolve this ?
=> this below are my capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.DEVICE_NAME, “suresh”);
caps.setCapability(MobileCapabilityType.UDID, “d27d6eef”);
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, “Android”);
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, “12 SKQ1.211019.001”);
caps.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60);
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, “UiAutomator2”);

		caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.miui.calculator");
		caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.miui.calculator.cal.CalculatorActivity");
		caps.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true);

		// Set the URL for Appium server
		URL url = new URL("http://127.0.0.1:4723/");

		// Initialize AppiumDriver instance
		appiumDriver = new AndroidDriver<MobileElement>(url, caps);

It quite clear. TouchAcrions depecated. Use w3c commands now.

actually, I’m trying to click dropdown/spinner options but these options don’t have id or xpath. that’s why I choose touchActions. I asked andriod developers they used material spinner that’s the reason id or xpath showing in appium inspector. can you guide me sir how to select these type of cases?

The same can do w3c actions. Just replace:

Point point = new Point(rectangle.x + (rectangle.width / 2), rectangle.y + (rectangle.height / 2));
->
Point point = new Point(yourX, yourY);
1 Like