 
 // Please don't remove the lines below
 // They are used to detect outdated configuration files
-// SnapshotHelperVersion [1.6]
+// SnapshotHelperVersion [1.9]

            waitForLoadingIndicatorToDisappear(within: timeout)
        }

        print("snapshot: \(name)") // more information about this, check out https://github.com/fastlane/fastlane/tree/master/snapshot#how-does-it-work

        sleep(1) // Waiting for the animation to be finished (kind of)

        #if os(OSX)
            XCUIApplication().typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: [])
        #else
            let screenshot = app.windows.firstMatch.screenshot()
            guard let simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }
            let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png")

                throw SnapshotError.cannotDetectUser
            }

            guard let usersDir = FileManager.default.urls(for: .userDirectory, in: .localDomainMask).first else {
                throw SnapshotError.cannotFindHomeDirectory
            }

            homeDir = usersDir.appendingPathComponent(user)
        #else
            #if arch(i386) || arch(x86_64)
                guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else {
                    throw SnapshotError.cannotFindSimulatorHomeDirectory
                }
                guard let homeDirUrl = URL(string: simulatorHostHome) else {
                    throw SnapshotError.cannotAccessSimulatorHomeDirectory(simulatorHostHome)
                }
                homeDir = URL(fileURLWithPath: homeDirUrl.path)
            #else
                throw SnapshotError.cannotRunOnPhysicalDevice
            #endif
        #endif
        return homeDir.appendingPathComponent("Library/Caches/tools.fastlane")
    }
