appium / appium-for-mac

[deprecated] Application for automating a mac app with JSON wire protocol
Apache License 2.0
193 stars 70 forks source link

Running AppiumForMac with logged out user #103

Closed bumbu closed 3 years ago

bumbu commented 3 years ago

I'm able to run tests against Mac desktop app via AppiumForMac from the same machine, or from a remote machine as long as the user is logged in.

If the user is logged out (I log-in, start an ssh daemon, log-out) and then try to run the test - it will fail because AppiumForMac will not find the app (it will never become the front app).

Did anyone find any work-arounds for this? Is it even possible to run it with the user being logged-out (or it has to be logged in at all times)?

Thanks

KazuCocoa commented 3 years ago

Probably log-in session is necessary to get Window service on macOS. Or some process could work if the parent process was launchd

bumbu commented 3 years ago

The issue in my case was that the screensaver was running. I tried a bunch of things, like:

    caffeinate -u -t 2

    osascript -e 'tell application \"System Events\" to key code 123'

    osascript -e 'tell application "System Events" to get name of application processes whose frontmost is true and visible is true'

    pmset schedule wake "$(date -v+7S '+%m/%d/%Y %T')"

but none of them did work in my case. What did work was simulating a click and spacebar keypress using cliclick like ./cliclick c:1,1 kp:space (you need to build cliclick on your own).