Jump to content

IE question


Recommended Posts

I have not had the chance yet to play with any of the IE functions and I was hoping one of you who has could point me in the right direction.

  • I want to develop an app that will verify that some (call it 50) web pages are working (not 404).
  • I would prefer that I not have to actually view each of the pages attempting to load. (hidden IE windows?)
  • I would also like multiple pages to be tested at a time, so I'm not waiting too long on any given one in the list to time out before moving on to the others. (how do I queue say 5 pages being tested at a time)

With those things in mind, could you point out a few key IE.au3 functions/features that I should focus on to make this happen?

P.S. Yes I know there are 3rd party apps that will do this, I just happen to LIKE re-inventing the wheel :)

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

ping does not equal web page loading

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Perhaps I should break this down a bit. For example in this code I am trying to find the error that shows that the url is not valid. Obviusly I am expecting a different result that what happens, what am I missing?

#include <IE.au3>
$AutoIt = _IECreate("www.autoitscript.com", 0, 1, 0)
$Google = _IECreate("www.google.com", 0, 1, 0)
$fail = _IECreate("abc.xyz.com", 0, 1, 0)
MsgBox(4096, "results", "Autoit=" & $AutoIt & @CRLF & _
        "Google=" & $Google & @CRLF & _
        "abc.xyz=" & $fail & @CRLF & _
        "error=" & @error)

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

THIS DOESN'T WORK!

The code I posted below does though :)

this would check google:

#include<IE.au3>
Dim $error[10]
$error[1] = "($_IEStatus_GeneralError) = General Error "
$error[3] = "($_IEStatus_InvalidDataType) = Invalid Data Type "
$error[4] = "($_IEStatus_InvalidObjectType) = Invalid Object Type "
$error[6] = "($_IEStatus_LoadWaitTimeout) = Load Wait Timeout "
$error[8] = "($_IEStatus_AccessIsDenied) = Access Is Denied "
$error[9] = "($_IEStatus_ClientDisconnected) = Client Disconnected "
$oIE = _IECreate( "www.google.com", 0, 0, 1 )
If @error <> 0 Then
    MsgBox(0, "Web Page Test", "Page could not load." & @CRLF & $error[@error] )
Else
    MsgBox(0, "Web Page Test", "Page loaded fine" )
EndIf

Hmmm.... I just tested this and it doesn't work... sorry, I will try to adjust it.... it detects pages that don't exist as loaded fine

Edited by danwilli
Link to comment
Share on other sites

found this under _IENavigate:

This function always returns a value of -1. This is because the navigate method has no return value and therefore nothing can be implied from it. You will need to employ other methods to determine success or failure of the navigation.

which is why my code didn't work

Link to comment
Share on other sites

ok ok, this should do it, you can add in different error support besides the one I included:

#include<IE.au3>
$oIE = _IECreate( "http://www.google.com/", 0, 0, 1 )
$errors = 0
If StringInStr(_IEBodyReadText( $oIE ), "The page cannot be displayed" ) <> 0 Then
    MsgBox(0, "test", "The page cannot be displayed" )
    $errors = $errors + 1
EndIf
If $errors = 0 Then MsgBox(0, "test", "Page loaded ok")
Edited by danwilli
Link to comment
Share on other sites

Thanks danwilli

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...