From 733712d296a739c81d849a3984226d15b2b93dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=90=8D=E5=90=9B?= Date: Mon, 5 Nov 2018 18:54:11 +0800 Subject: [PATCH] Make screenshot more stable --- WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m index 4f06896c5..7647c9e24 100644 --- a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m @@ -22,6 +22,7 @@ #import "XCUIDevice.h" #import "XCUIScreen.h" +#import "FBConfiguration.h" static const NSTimeInterval FBHomeButtonCoolOffTime = 1.; static const NSTimeInterval FBScreenLockTimeout = 5.; @@ -107,7 +108,7 @@ - (NSData *)fb_screenshotWithError:(NSError*__autoreleasing*)error { FBApplication *activeApplication = FBApplication.fb_activeApplication; UIInterfaceOrientation orientation = activeApplication.interfaceOrientation; - CGSize screenSize = FBAdjustDimensionsForApplication(activeApplication.frame.size, orientation); + CGSize screenSize = [FBConfiguration screenSize]; CGRect screenRect = CGRectMake(0, 0, screenSize.width, screenSize.height); // https://developer.apple.com/documentation/xctest/xctimagequality?language=objc // Select lower quality, since XCTest crashes randomly if the maximum quality (zero value) is selected