Automating Logging Into OS X After System Restart Background

I have a bunch of OS X Yosemite Mac Minis that are used as slaves by a Jenkins master machine to run Selenium tests using Google Chrome.

These slave machines get restarted on a daily basis. 

Problem

After the restart, the machines are at a login screen asking for a username and password. Running Google Chrome remotely on the machines fails until a manual login is performed.

Is there a way to automate this login?

Things I have tried


Executing a login script remotely on the Mac Mini using ssh root@&lt;macmini-address&gt; "bash -s" &lt; ./login.sh where login.sh contains the following:



#!/bin/bash
osascript &lt;&lt;EOF
tell application "System Events"
keystroke "&lt;replace with user&gt;"
keystroke tab
delay 0.5
keystroke "&lt;replace with password&gt;"
delay 0.5
keystroke return
keystroke return
end tell
EOF



This results in the following error: 

33:49: execution error: An error of type -10810 has occurred. (-10810)



Sending the above AppleScript to the Mac Mini through Apple Remote Desktop (ARD).


This works but on some occasions, ARD is not able to send the script over to some Mac Minis showing a 'Client Software Not Active' message in the ARD status column.
macOS has an automated login feature.


Choose System Preferences from the Apple menu (), then click Users &amp; Groups.
Click the lock  , then enter account password.
If you aren't logged in as an administrator, you're asked to enter an administrator's name and password.
Click Login Options.
Choose an account from from the “Automatic login” pop-up menu, then enter the password of that account.
The account is now set up to log in automatically when your Mac starts up. You might still be asked to log in manually after logging out, switching back from another user account, or locking your screen.




Not all accounts work for automatic login. If you can't select your account, make sure FireVault is turned off and the account doesn't use an iCloud password for the login.