I am passing the username using the script, but for the password part, i want to do that interactively, once the password is entered by the user then the script should proceed with next steps. I am using the below script, once username is populated in the website then sleep for 2 mins after that click on login. But its not working, its not coming out of sleep. Kindly let me know if i miss anything or any other alternative option
Create an Internet Explorer object
$ie = New-Object -ComObject ‘internetExplorer.Application’
$ie.Visible= $true # Make it visible
Open all websites
$ie.Navigate(“mywebpage”)
Script to wait till webpage is downloaded into the browsers.
while ($ie.Busy -eq $true){Start-Sleep -seconds 4;}
Feed in your credentials to the input fields on the web page
$usernamefield = $ie.Document.getElementByID(‘j_username’)
$usernamefield.value = ‘user’
Start-Sleep -seconds 120 ----(User enters the Password during this period)
My advice is to get the information at the start of the script. Adding a param() block at the beginning of your script to prompt for username and password would do the trick. The advantage is that users could store the credentials securely in an encrypted form on disk and reuse while passing the Credential parameter.
I am new to Powershell, Could you please help me on this.
How do i pass the password information as parameter/variable so that i can automate my login proceess.