Created
February 11, 2016 02:20
-
-
Save matthewreagan/d5da35f7604da5673c24 to your computer and use it in GitHub Desktop.
Click-drag on XCUIElement category method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)clickAtPoint:(CGPoint)pointInElement thenDragTo:(CGPoint)point2InElement | |
{ | |
CGRect frame = self.frame; | |
CGFloat width = CGRectGetWidth(frame); | |
CGFloat height = CGRectGetHeight(frame); | |
XCUICoordinate *coord1 = [self coordinateWithNormalizedOffset:CGVectorMake(pointInElement.x / width, pointInElement.y / height)]; | |
XCUICoordinate *coord2 = [coord1 coordinateWithOffset:CGVectorMake(point2InElement.x - pointInElement.x, point2InElement.y - pointInElement.y)]; | |
[coord1 clickForDuration:0.1 thenDragToCoordinate:coord2]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment