when these two line executes somehow my old password shows up in the field. I have checked it with inspect elements and I see my old password. When I copy paste the same password from the code it works.
What is happening? Anyone knows?
IE is probably auto-remembering your old password and filling it in, overwriting whatever you've programmatically inserted. You might try putting a Start-Sleep between the end of the page load and you inserting those values. That should give IE time to auto-fill, and then you can overwrite those values. Or, dis-remember the remembered values for that page.