Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let statusBar = XCUIApplication().statusBars.elementBoundByIndex(0)
- statusBar.swipeDown()
- let iconFrame = icon.frame // App icon on the springboard
- let springboardFrame = springboard.frame // The springboard (homescreen)
- icon.pressForDuration(1.3) // tap and hold
- // Tap the little "X" button at approximately where it is. The X is not exposed directly
- springboard.coordinateWithNormalizedOffset(CGVectorMake((iconFrame.minX + 3) / springboardFrame.maxX, (iconFrame.minY + 3) / springboardFrame.maxY)).tap()
- let myElementFrame = myElement.frame
- let appFrame = XCUIApplication().frame
- let middleOfElementVector = CGVectorMake(iconFrame.midX / appFrame.maxX, iconFrame.midY / appFrame.maxY)
- // Tap element from the app-level at the given coordinate
- XCUIApplication().coordinateWithNormalizedOffset(middleOfElementVector).tap()
- let springboard = XCUIApplication(privateWithPath: nil, bundleID: "com.apple.springboard")
- springboard.resolve()
- @interface XCUIApplication (Private) {
- - (id)initPrivateWithPath:(id)arg1 bundleID:(id)arg2;
- }
- @interface XCUIElement (Private) {
- - (void) resolve;
- }
- let bottomPoint = app.coordinate(withNormalizedOffset: CGVector(dx: 0, dy: 2))
- app.coordinate(withNormalizedOffset: CGVector(dx: 0, dy: 0)).press(forDuration: 0.1, thenDragTo: bottomPoint)
- let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
- springboard.scrollViews.firstMatch.swipeRight()
- let editButton = springboard.buttons["Edit"]
Add Comment
Please, Sign In to add comment