Internet Explorer change drop down menu

Welcome Forums General PowerShell Q&A Internet Explorer change drop down menu

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
3 years, 9 months ago.

  • Author
    Posts
  • #23636

    Participant
    Points: 0
    Rank: Member

    been trying to log into this ticketing webpage and download a report
    was able to get past the log in screen
    and then redirect to the search page

    I'm not able to change the drop down

    i tried following http://stackoverflow.com/questions/15150397/powershell-select-drop-down-menu-from-web-page and http://stackoverflow.com/questions/5379922/select-option-on-dropdown-list-for-web-ui-testing-automation-in-windows-powershe

    with no luck. I commented out what i tried.

    i get this error message usually

    Property 'Selected' cannot be found on this object; make sure it exists and is settable.
    At C:\Users\max\Desktop\test\90.ps1:73 char:44
    + ($dropdown | where {$_.innerHTML -eq "1"}). <<<< Selected = $two + CategoryInfo : InvalidOperation: (Selected:String) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound Any assistance would be appreciated. pre $Url = “website” $Url2 = "webstite2" $Username=”user” $Password="password” $Executable = "C:\Program Files (x86)\Internet Explorer" $IE = New-Object -com internetexplorer.application; $IE.visible = $true; $IE.navigate($url); while ($IE.Busy -eq $true) { Start-Sleep -Milliseconds 2000; } $IE.Document.getElementById(“userid”).value = $Username $IE.Document.getElementByID(“ubspwd”).value=$Password while ($IE.Busy -eq $true) { Start-Sleep -Milliseconds 2000; } $Link=$ie.Document.getElementsByTagName("input") | where-object {$_.type -eq "submit"} $Link.click(); while ($IE.Busy -eq $true) { Start-Sleep -Milliseconds 2000; } $IE.navigate($url2); while ($IE.Busy -eq $true) { Start-Sleep -Milliseconds 2000; } $Link=$ie.Document.getElementsByID("select#SEARCH_WRK_CALLER_TYPE_ID.psdropdownlist") | where-object {$_.type -eq "3"} #$Link=$ie.Document.getElementsByTagName("input") | where-object {$_.type -eq "submit"} #($Link | where {$_.innerHTML -eq "1"}).Selected = $true #| where-object {$_.type -eq "BOMTECH"} #$doc = $ie.document #$listbox = $doc.getelementbyClass("PSDROPDOWNLIST").value = "Branch" #$dropdown = $ie.Document.getElementById("SEARCH_WRK_CALLER_TYPE_ID") #($dropdown | where {$_.innerHTML -eq "1"}).Selected = $true HTml ARC Service Center Alternative Investments BOM & PWM Client Escalation TECH Branch Branch PWM/WA/CC Branch/NRS Br C's Club Choose A Caller Type Client Client/Internal Client/Other Command Center Dis Pilot Branch 7 First Aid GTS IS Managed Desk Managed dept Support Team Municipal Securities Outbound Services Place Holder SG Hotline SG Tech Outage Service Recovery Tech Mgr Esc Tech Telecommuter Technical Other Technical/External Technical/Internal Trt/Branch Tde Support/Client Tre WAC Service Desk White Glove /pre

  • #23642

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    PowerShell isn't a good language for messing with the DOM via IE. That's a pretty old COM interface, and it doesn't translate especially well into .NET.

The topic ‘Internet Explorer change drop down menu’ is closed to new replies.