ie.Navigate ('URL') ie.SetTextBox(username,'txtUserId',0) not sure but shouldn't you be waiting for navigate to actually finish loading the page before setting fields?
see the ie.Busy or ie.readyState properties/methods -- http://mail.python.org/mailman/listinfo/python-list