Leo Torres
asked on
Powershell click button on page and watch as it processes
OK so upon testing I have noticed a few things.
1. When I run script from function I don't see it open the IE window and step thru pages and clicks. I have no way validating whats happens. I only get IE browser but its blank I see no movement.
2. I am finding it kinda odd that I am not getting any -200 errors.
3. In the function file why is the IE object created outside function. When you call function that code does not run correct?
4. When I run script once works fine. once done and run the second time I get this error.
If I shutdown PowershellISE and start it again works fine. Does it have something to do with the fact I closed the IE Window that was open by the session on first go round.
From Question
https://www.experts-exchange.com/questions/28494276/Powershell-need-to-find-this-value.html
Test-ReportSite.txt
Website-Monitoring-Ver3.txt
1. When I run script from function I don't see it open the IE window and step thru pages and clicks. I have no way validating whats happens. I only get IE browser but its blank I see no movement.
2. I am finding it kinda odd that I am not getting any -200 errors.
3. In the function file why is the IE object created outside function. When you call function that code does not run correct?
4. When I run script once works fine. once done and run the second time I get this error.
If I shutdown PowershellISE and start it again works fine. Does it have something to do with the fact I closed the IE Window that was open by the session on first go round.
From Question
https://www.experts-exchange.com/questions/28494276/Powershell-need-to-find-this-value.html
Test-ReportSite.txt
Website-Monitoring-Ver3.txt
for those that are interested here is the proper link: https://www.experts-exchange.com/questions/28494276/Powershell-need-to-find-this-value.html
You used the Test-ReportSite the wrong way. You code only
* creates a new IE, if the global IE var is not already set
* defines the Test-ReportSite function
and the function is never called. Because the script does not return anything, $ReportTest is empty, and your error tests do not work.
Also, if you close the IE created in the script, the check inside the Test-ReportSite script does not work, and causes errors as shown.
On another note: The main code isn't written very well, doing things twice, inproperly indented and such. Also, it uses WebClient, Invoke-WebRequest and (in my code) the InternetExplorer.Applicati on COM object, which is an unnecessary mixture of different techniques for the same purpose (each one uses an own IE).
In short, both codes need major reworks. I will try to do the minimum first, not changing much in both.
* creates a new IE, if the global IE var is not already set
* defines the Test-ReportSite function
and the function is never called. Because the script does not return anything, $ReportTest is empty, and your error tests do not work.
Also, if you close the IE created in the script, the check inside the Test-ReportSite script does not work, and causes errors as shown.
On another note: The main code isn't written very well, doing things twice, inproperly indented and such. Also, it uses WebClient, Invoke-WebRequest and (in my code) the InternetExplorer.Applicati
In short, both codes need major reworks. I will try to do the minimum first, not changing much in both.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow this works to the tee.. There are a few exceptions. Like when all the reports are in a folder there is only 1 frame so it records error. BUt over all this code is spot on. Thank you. I need to done another one this weekend. Thank thanks again