Finally figured out how to wait for the time to change on the device.
Final adjustment (I hope).
Fixed the last switchToFrame().