OSX login window - fails to login

I have scripts that need to log into an OSX sut. I am seeing very ‘flaky’ behavior when the eggplant script attempts to log into the OSX machine. It will work maybe 70% of the time. This makes no sense to me since I am using the exact same user/password every time I run the script.

I created a test script that just does the following:

  • login as local user
  • logout

I ran this script 10 times in a row. It successfully logged in only 3 times. The other 7 times failed to log in.

I then ‘manually’ logged into the system 12 times in a row. (Manually was sitting at the desktop of the machine and logging in). I successfully logged in 10 of the times (and given the fact that there was possibly human error, that is nearly 100% success rate).

So, I am not sure what the hangup is when running through the script but a 30% success really stinks. And is not something I can reliably count on for my testing.

Does anyone know if this is a:

  • Eggplant issue
  • vnc server issue

Please help. We are getting down to the wire on putting our demo together for this and I am really frustrated at this point.

We have scripts that reliably log-in nightly so it can be done. However the timing on the Vine Server restarting can be tricky at times and you need to make sure to allow enough time for this to occur.

Background information: As a security precaution when you log out Mac OS X forces all running applications that have had contact with the Window Server be shutdown – this includes VNC. This is to prevent someone from running a trojan or other inappropriate software.

So first off, make sure that you have Vine Server running as a System Server. Make sure that you allow adequate time for the Vine Server to shutdown and then be restarted properly.

That loop would look something like this (and is similar to scripting a process to handle a machine reboot). I just ran this here successfully to verify it but your timing parameters may need to be adjusted slightly.

set user to "Jonathan"
set password to ""
set myServer to connectionInfo().serverid

repeat 10 times
	TypeText user & return
	TypeText password & return
	-- If you are loading lots of things at startup you might need to wait for things here
	WaitFor 10, "AppleMenu"
	Click foundImageLocation()
	Click "LogOut"
	Click "LogOutButton"
	disconnect -- we WILL get disconnected, best to do it on our terms
	wait 20 seconds -- This must be long enough to make sure the server exits
       put the time + 60 into endtime
	repeat until the time > endtime
			connect (serverid: myServer, sshUser: the long time & "")
			-- The SSHUser property corrects a problem with disconnect in 3.31
		end try
		if connectionInfo().connected then exit repeat
	end repeat
end repeat	

I thought it was pretty clever of sensetalk to be able to measure time in a repeat loop like that. Then I realized it isn’t measuring time, it’s repeating for however many seconds are in a minute, for instance.

I had code:
repeat for 2 minutes

I noticed that it didn’t wait anywhere near two minutes. Then I noticed that the statements in my repeat loop got executed exactly 2 * 60 times.


D’oh good catch, I wasn’t sure that would work either but since it compiled I figured it was good.

Historical Note: I’ve modified the example to use an endtime variable but it used to say:

repeat for 1 minutes

end repeat

I applied this cheesy approximation hack:

repeat 2 minutes
Wait 1 second
end repeat

There is something appalling, yet beautiful about that. :slight_smile: