Log into website and download a statement using powershell

I used the following code to login into a webpage.

$ie = New-Object -com InternetExplorer.Application
while($ie.Busy -or $ie.ReadyState -ne 4) {start-sleep -m 500}
$ie.Document.IHTMLDocument3_getElementById("ctl00_username").value = "abcdef"
$ie.Document.IHTMLDocument3_getElementById("ctl00_password").value = "123456"
start-sleep 2
$ie.Document.body | Out-File -FilePath C:\Users\averm\Documents\adi\test\web123.txt

But I need some more help with this code. I'm logging into the page but i need to download a statement. The attached images shows you what to download.

Step1: In home page under "Reports" i need to select "Aging"
Step2: In "Aging" page i need to go to "Aging Group" and select "Direct Energy Aging" and select "Export". so that it will download my statement.

The following 4 images may help you to get some information. Please help me to find the solution.
aditya vermaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jose Gabriel Ortega CastroCEO Faru Bonon IT - EE Solution ExpertCommented:
You would need to jump into the html code using F12 and do the steps 1 and 2 that are missing.
This is what you're doing.

You just need to go deep into the html code and use it to select and simulate the user's action.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PberSolutions ArchitectCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Jose Gabriel Ortega C (https:#a42430229)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.