How to click a link under drop down menu

This topic contains 4 replies, has 2 voices, and was last updated by Profile photo of Korhan Tezel Korhan Tezel 1 year, 1 month ago.

  • Author
  • #29476
    Profile photo of Korhan Tezel
    Korhan Tezel

    Hi all,
    I am new to this community since I am only a beginner in PS.
    I am trying to automate data upload to a certain website. I was able to dial and log in so so far. However, there is one part that I am stuck. I am trying to click a link which is under a certain title. Here how that looks like:

    "a title="" href="https://......?alerts=1" target="_self">Inventory AlertsInventory Management

  • #29479
    Profile photo of Rob Simmers
    Rob Simmers

    That is HTML, not Powershell. Are you creating a HTML Report from Powershell? Your question is vague and there is no Powershell code to look at. Please provide more information.

  • #29481
    Profile photo of Korhan Tezel
    Korhan Tezel

    Sorry about the confusing message. I was having trouble while I was posting.
    Here is my code
    # Initiate an internet explorer object
    $ie = New-Object -com InternetExplorer.Application
    $ie.Visible = $True
    $url = ""
    while($ie.busy){Start-Sleep 1}

    # Enter login information
    $ie.Document.getElementById("js-username").value = "username"
    $ie.Document.getElementById("password_field").value = "password"

    # Click Inventory Management under Inventory & EDI Tab or Dropdown menu
    I am trying to click a drop down menu under Inventory & EDI tab.
    When I inspect the elements this what I get
    ul id="Inventory_&_EDI"

    li id="js-inventory-alerts-link"
    a title = "" href = "https://.....................................php?alerts=1" target="_self">Inventory Alerts
    a title="" href = "https://.......................................php" target="_self">Inventory management

  • #29546
    Profile photo of Rob Simmers
    Rob Simmers

    Although you are using Powershell to run this code, you are actually using HTML Document Object Model (DOM). Most DOM examples will be JavaScript that will provide examples of how to access dropdown children and perform actions. You may also see jQuery, but keep in mind that it is basically JavaScript short-hand and will be difficult to translate into something usable with a DOM approach unless you understand jQuery. I searched for "javascript open link in dropdown" and there are examples of opening a link in another window. You would use Navigate or Navigate2 versus Window.Open.

  • #29576
    Profile photo of Korhan Tezel
    Korhan Tezel

    Thank you, Rob.
    I have handled this part of the program with PowerShell.
    There are many challenges waiting ahead though.

You must be logged in to reply to this topic.