在Appium拖动过程中采取截图 [英] Take a screenshot during dragging in Appium
问题描述
在Android中,我需要拖动一个对象在我的应用程序,并采取截图同时仍持有的对象。
In Android, I need to drag an object in my app and take a screenshot WHILE STILL HOLDING the object.
我知道有采用触摸操作的两种方式(我还没有考虑更高层次的方法,如刷卡()
,因为他们给我少得多在我接触的动作控制):
I know that there are two ways of using touch actions (I'm not even considering the higher-level methods such as swipe()
as they give me much less control over my touch actions):
new TouchAction(driver).press(element).moveTo(x,y).release().perform();
和
driver.performTouchAction(new TouchAction(driver).press(element).moveTo(x,y).release());
当我尝试我的触摸动作分成两部分,如下面的code之间插入一个截图捕捉:
When I try to divide my touch action into two parts, and inserting a screenshot capture in between as in the code below:
new TouchAction(driver)
.press(x,y)
.moveTo(newX,newY)
.perform();
takeScreenshot(); // My own implementation for readability
new TouchAction(driver)
.release()
.perform();
我收到以下错误:
I get the following error:
org.openqa.selenium.WebDriverException: ERROR running Appium command: Cannot read property 'x' of null
Command duration or timeout: 14 milliseconds
该计划第二次触摸操作过程中出现故障,即屏幕截图正在顺利拍摄,但我没有用这种方式抢夺后释放对象的方法。
The program fails during the second touch action, i.e., the screenshot is being successfully taken, but I have no way of releasing the object after grabbing it in this manner.
任何想法?
推荐答案
通过查看您的问题
new TouchAction(driver)
.release()
.perform();
发布提供了一些X和Y位置释放有一个尝试可能工作
for release provide some x and y location to release have a try might work
这篇关于在Appium拖动过程中采取截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!