Author Posts

September 8, 2015 at 10:43 am

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

September 8, 2015 at 10:57 am

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.

September 8, 2015 at 11:02 am

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

September 9, 2015 at 8:09 am

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.

September 9, 2015 at 2:05 pm

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