简体   繁体   English

按代码截取iOS设备的屏幕截图(不是swift或xamarin)

[英]Take screenshot of iOS device by code (not swift or xamarin)

I'm working on verifying screen of the iOS app by using tesseract engine (OCR). 我正在使用tesseract引擎(OCR)验证iOS应用程序的屏幕。 I'm using Ranorex (Test automation tool) that use .net 4.5 frame. 我正在使用使用.net 4.5帧的Ranorex(测试自动化工具)。

MobileApp targetApp = repo.App;
    Bitmap actualImage = Imaging.CaptureImage(targetApp,0,true);

I used above code to get a bitmap of the current screen. 我使用上面的代码来获取当前屏幕的位图。 However, the resolution is too low to run OCR. 但是,分辨率太低而无法运行OCR。 Therefore, I need to work on the other ways. 因此,我需要在其他方面开展工作。

1st: If Ranorex has some function that takes high resolution of the screen image. 第一:如果Ranorex有一些功能需要高分辨率的屏幕图像。

2nd: If there is c#(.net frame 4.5) code that can get high resolution of the screen image. 第二:如果有c#(.net frame 4.5)代码可以获得高分辨率的屏幕图像。

3rd: Find a tool to take a screen shot of iPad app (external tool), and save all high resolution screen shot first, and read the file by bitmap(C:\\xxxx). 第3步:找到一个工具来拍摄iPad应用程序(外部工具)的屏幕截图,并先保存所有高分辨率屏幕截图,然后按位图(C:\\ xxxx)读取文件。

It would be great if I can get a good suggestion. 如果我能得到一个好的建议,那就太好了。

Thank you for helping me. 感谢你们对我的帮助。

You can take screenshots using the UIAutomation framework from Apple. 您可以使用Apple的UIAutomation框架截取屏幕截图。

You can use this code to generate screen shots: 您可以使用此代码生成屏幕截图:

target.captureScreenWithName("HomeScreen"); target.captureScreenWithName( “主屏幕”);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM