How to login gmail through powershell script?

Hi,
I am trying to make powershell script to login gmail .I tried following code for username and password:
$ie.document.getElementById(“email”).value= “$username”
$ie.document.getElementById(“Passwd”).value = “$password”

Username field is working fine but password is not working with error:
The property ‘value’ can not be found on this object. Verify that the property exists and can be set.

Could you Please help me in this?

Regards,
Samidha

Have you gone through this post?

https://social.technet.microsoft.com/Forums/windowsserver/en-US/b83eb145-6d52-4ccd-896e-829a75ea0168/powershell-getelementbyid-not-working-with-ie11?forum=winserverpowershell