在testcomplete中比较JS中的图片
comparing pictures in JS in testcomplete
因此,我实际上想做的是验证网页上显示的图片是否符合我的预期。我知道我可以使用以下代码比较两张图片:
var MyPic = page.someLocation.Picture();
Regions.Compare(MyPic, PictureToCompare)
我无法弄清楚如何创建 PictureToCompare 变量。我希望将其作为图像保存在 testcomplete 内部,以检查我的网页上当前的内容。有办法吗?
你可以使用Utils.Picture property and initialize it with an image using the LoadFromFile方法得到一个空的Picture对象:
var PictureToCompare = Utils.Picture;
PictureToCompare.LoadFromFile("c:\myImage.png");
因此,我实际上想做的是验证网页上显示的图片是否符合我的预期。我知道我可以使用以下代码比较两张图片:
var MyPic = page.someLocation.Picture();
Regions.Compare(MyPic, PictureToCompare)
我无法弄清楚如何创建 PictureToCompare 变量。我希望将其作为图像保存在 testcomplete 内部,以检查我的网页上当前的内容。有办法吗?
你可以使用Utils.Picture property and initialize it with an image using the LoadFromFile方法得到一个空的Picture对象:
var PictureToCompare = Utils.Picture;
PictureToCompare.LoadFromFile("c:\myImage.png");