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
$ie.visible=$true
$ie.navigate("https://sfe-uat.epway.com")
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"
$ie.Document.IHTMLDocument3_getElementById("ctl00_login").click()
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.
1.png
2.png
3.png
4.png
aditya vermaAsked:
Who is Participating?

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

x
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.

https://gallery.technet.microsoft.com/scriptcenter/Open-Internet-Explorer-e4f8ae4b
You just need to go deep into the html code and use it to select and simulate the user's action.

Jose

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.

Pber
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
Powershell

From novice to tech pro — start learning today.