Need Help with Code for Auto Logon to a Website

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 4 months ago.

  • Author
    Posts
  • #5670

    by Shellshocked at 2013-03-15 11:12:08

    Hello,

    I'm new to Powershell and was wanting to get some help with a script. I was trying to create a script to auto logon to a website. Currently my script will open the web page but after that nothing happens. I was hoping some one could review my script and the source of the web page and help with where i'm going wrong. I will post the script and the source page below.

    Script

    $username = "name"
    $password = "password"

    $ie = New-Object -comobject InternetExplorer.Application
    $ie.visible = $true
    $ie.silent = $true
    $ie.Navigate( "http://site&quot😉
    while($ie.ReadyState -ne 4){Start-Sleep -m 100}
    $ie.Document.getElementById("webUsername").value = "$username"
    $ie.Document.getElementById("webPassword").value = "$password"
    $ie.Document.getElementById("submit").IHTMLElement_click()

    Source


    Login

    User ID

    Password

    by DonJ at 2013-03-16 09:08:11

    You're using GetElementByID but the submit button doesn't have an ID. Its type attribute does not constitute an ID attribute. In fact, none of the input elements have an ID – a "name" is also not "id."

You must be logged in to reply to this topic.