代码如下: using System.Runtime.InteropServices; using System.Drawing.Imaging; [System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")] private static extern bool BitBlt( IntPtr hdcDest, // 目标 DC的句柄 int nXDest, int nYDest, int nWidth, int nHe
以下代码是在QC里运行QTP来执行脚本过程,当执行过程中发现用例失败后就会自动截图,然后把用例返回到最初始的状态,模拟了场景恢复的机制 Class QCImageErrorCapture Dim qtpApp Sub Class_Initialize() Set qtpApp = CreateObject("QuickTest.Application") If qtpApp.CurrentDocumentType = "Test" Then qtpApp.Test.
简单介绍 需求场景是:当测试安卓应用的脚本得到失败结果时,对当前手机屏幕截图,便于查找问题. 实现方式是:1)定义一个父类UITest,作为所有测试类的父类.在父类中UITest中定义一个截图的方法,所有的子类就都可以使用这个方法了.2)实现testng的ITestListener接口,参考这里,在这个接口的onTestFailure方法中调用测试类的截图方法. 定义测试脚本的父类 package main.java.com.dbyl.library.utils; /** * Created b
1: private void Yincangtimer_Tick(object sender, EventArgs e)//窗体隐藏事件 2: { 3: int a = Control.MousePosition.Y;//光标的在屏幕中的 Y 坐标 4: int b = Control.MousePosition.X;//光标的在屏幕中的 X 坐标 5: int height = Screen.PrimaryScreen.WorkingArea.Height;//屏幕的高 6: int wid