@@ -49,35 +49,35 @@ @implementation XCUIElement (FBScrolling)
4949
5050- (BOOL )fb_nativeScrollToVisibleWithError : (NSError **)error
5151{
52- id <FBXCElementSnapshot> snapshot = [self fb_takeSnapshot: YES ];
52+ id <FBXCElementSnapshot> snapshot = [self fb_customSnapshot ];
5353 return nil != [self _hitPointByAttemptingToScrollToVisibleSnapshot: snapshot
5454 error: error];
5555}
5656
5757- (void )fb_scrollUpByNormalizedDistance : (CGFloat)distance
5858{
59- id <FBXCElementSnapshot> snapshot = [self fb_takeSnapshot: YES ];
59+ id <FBXCElementSnapshot> snapshot = [self fb_customSnapshot ];
6060 [[FBXCElementSnapshotWrapper ensureWrapped: snapshot] fb_scrollUpByNormalizedDistance: distance
6161 inApplication: self .application];
6262}
6363
6464- (void )fb_scrollDownByNormalizedDistance : (CGFloat)distance
6565{
66- id <FBXCElementSnapshot> snapshot = [self fb_takeSnapshot: YES ];
66+ id <FBXCElementSnapshot> snapshot = [self fb_customSnapshot ];
6767 [[FBXCElementSnapshotWrapper ensureWrapped: snapshot] fb_scrollDownByNormalizedDistance: distance
6868 inApplication: self .application];
6969}
7070
7171- (void )fb_scrollLeftByNormalizedDistance : (CGFloat)distance
7272{
73- id <FBXCElementSnapshot> snapshot = [self fb_takeSnapshot: YES ];
73+ id <FBXCElementSnapshot> snapshot = [self fb_customSnapshot ];
7474 [[FBXCElementSnapshotWrapper ensureWrapped: snapshot] fb_scrollLeftByNormalizedDistance: distance
7575 inApplication: self .application];
7676}
7777
7878- (void )fb_scrollRightByNormalizedDistance : (CGFloat)distance
7979{
80- id <FBXCElementSnapshot> snapshot = [self fb_takeSnapshot: YES ];
80+ id <FBXCElementSnapshot> snapshot = [self fb_customSnapshot ];
8181 [[FBXCElementSnapshotWrapper ensureWrapped: snapshot] fb_scrollRightByNormalizedDistance: distance
8282 inApplication: self .application];
8383}
@@ -99,7 +99,7 @@ - (BOOL)fb_scrollToVisibleWithNormalizedScrollDistance:(CGFloat)normalizedScroll
9999 scrollDirection : (FBXCUIElementScrollDirection)scrollDirection
100100 error : (NSError **)error
101101{
102- FBXCElementSnapshotWrapper *prescrollSnapshot = [FBXCElementSnapshotWrapper ensureWrapped: [self fb_takeSnapshot: YES ]];
102+ FBXCElementSnapshotWrapper *prescrollSnapshot = [FBXCElementSnapshotWrapper ensureWrapped: [self fb_customSnapshot ]];
103103
104104 if (prescrollSnapshot.isWDVisible ) {
105105 return YES ;
@@ -209,7 +209,7 @@ - (BOOL)fb_scrollToVisibleWithNormalizedScrollDistance:(CGFloat)normalizedScroll
209209 // Cell is now visible, but it might be only partialy visible, scrolling till whole frame is visible.
210210 // Sometimes, attempting to grab the parent snapshot of the target cell after scrolling is complete causes a stale element reference exception.
211211 // Trying fb_cachedSnapshot first
212- FBXCElementSnapshotWrapper *targetCellSnapshotWrapped = [FBXCElementSnapshotWrapper ensureWrapped: [self fb_takeSnapshot: YES ]];
212+ FBXCElementSnapshotWrapper *targetCellSnapshotWrapped = [FBXCElementSnapshotWrapper ensureWrapped: [self fb_customSnapshot ]];
213213 targetCellSnapshot = [targetCellSnapshotWrapped fb_parentCellSnapshot ];
214214 CGRect visibleFrame = [FBXCElementSnapshotWrapper ensureWrapped: targetCellSnapshot].fb_visibleFrame ;
215215
@@ -229,7 +229,7 @@ - (BOOL)fb_isEquivalentElementSnapshotVisible:(id<FBXCElementSnapshot>)snapshot
229229 return YES ;
230230 }
231231
232- id <FBXCElementSnapshot> appSnapshot = [self .application fb_takeSnapshot: YES ];
232+ id <FBXCElementSnapshot> appSnapshot = [self .application fb_standardSnapshot ];
233233 for (id <FBXCElementSnapshot> elementSnapshot in appSnapshot._allDescendants .copy ) {
234234 FBXCElementSnapshotWrapper *wrappedElementSnapshot = [FBXCElementSnapshotWrapper ensureWrapped: elementSnapshot];
235235 // We are comparing pre-scroll snapshot so frames are irrelevant.
0 commit comments