locked
unable to login to website using powershell RRS feed

  • Question

  • I am trying to automate the login to the website but it doesn't work for me. Could it be due to nested DIVs ? When I see in DOM explorer it has multiple DIV class and the code starts with 

    <form name="aspnetForm" id="aspnetForm" onsubmit="javascript:return WebForm_OnSubmit();" 

    $username = "username" 
    
    $password = "password" 
    
    $IE= new-object -ComObject "InternetExplorer.Application"
    
    $url = "myurl"
    
    $IE.visible=$true
    
    $IE.navigate(“$url")
    
    $IE.Document.getElementById("ctl00_ContentPlaceBody_Login1_UserName").value="$username"
    
    $IE.Document.getElementById("ctl00_ContentPlaceBody_Login1_Password").value="$password"
    
    $IE.Document.getElementById("ctl00_ContentPlaceBody_Login1_ButtonSubmit").Submit(); 
    
    Start-Sleep -s 5
    
    
    
    
    





    Tuesday, October 10, 2017 9:43 AM

All replies