TouchAction辅助类基本操作

TouchAction辅助类

说明:TouchAction类中封装了所有基于手势操作方法(轻巧、拖拽、滑动)

使用TouchAction辅助类的原因 :

基于之前的API方法,元素的滑动只能基于两个坐标点或两个元素之间的话,多个元素无法实现。

	1. tap() 轻敲打
		操作:
			1. 导包 TouchAction()
			2. 调用tap方法 如;TouchAction(driver).tap(elemnet,x,y)
			3. 调用执行方法 如:TouchAction(driver).tap(elemnet,x,y).perform()
	2. press() 按下
		方法;
			# 基于元素 按下方法
			TouchAction(driver).press(elemnet).perform()
			# 基于坐标 按下方法
			TouchAction(driver).press(x=391,y=655).perform()
	3. relese() 释放 与按下对应
		方法:TouchAction(driver).press(x=391,y=655).release().perform()
	
	4. wait() 等待时间/毫秒
		方法:TouchAction(driver).press(wlan).wait(5000).release().perform()
	
	5. long_press() 长按
		方法:TouchAction(driver).long_press(wlan,duration=5000).release().perform()
		提示:long_press(el,time)=press(el).wait(time)
		
	6. move_to() 移动方法
		方法:
			1. TouchAction(driver).press(save).move_to(more).release().perform()
			2. TouchAction(driver).press(x=347,y=2006).move_to(x=0,y=944-2006).release().perform()
			
		提示: 
			1. 只要有press就应该有release()方法,否则容易出错或不执行。
			2. 基于坐标移动时候,坐标为前一个点的偏移量。
			3. appium版本大于1.6的时候,移动元素的坐标为上一个坐标的偏移量

	提示:	
		1. TouchAction辅助类所有的方法,都不能直接执行,需要调用perfrom()方法执行。

你可能感兴趣的:(软件测试,TOuchAction,元素操作)