I did some testing. I add a judgement to check if the logout button is there before click the logout. If not, then I let it re-click the login button. The problem seems go away. However, it then raises another question, do I have to check every click, and re-click it if it is not clicked? I tried to check the result of the click, even it fails, going the next page, the click gives me the success result.