Jump to content

IE Script freezing on Security Alert Popup


Recommended Posts

I have a site with a bad "Untrusted" ssl cert... giving a "The security certificate was issued by a company you have not chosen to trust. View the certificate to determine whether you want to trust the certifying authority" type of message...

now trying to get autoit to work around this popup (because getting a handfull of users to install certs is eh.. undesirable) it seems to hang using code like:

TrayTip("Web Auto: Enable...", "Attempting to login to Foo as: " & @UserName, 5, 1)
$oIE = _IECreate ("https://SiteWithBadCert.net", 0, 1, 1)

if @error == 0 Then
;TrayTip("Web Auto: Enable...", "Now logged in to Foo as: " & @UserName , 5, 1)
Else
    TrayTip("CMS Auto: Enable...", "Notice: Bad Security Certificate Detected attempting to bypass...", 5, 2)
    Send("!y")
    sleep(5000)
EndIf

however from the debug output....

0050: 0-0: TrayTip("Web Auto: Enable...", "Attempting to login to Foo as: " & @UserName, 5, 1)
0051: 0-0: $oIE = _IECreate ("https://SiteWithBadCert.net", 0, 1, 1)

it hangs at this point unless i manually click the yes button... actually as i typed it i got a...

--> IE.au3 V2.3-1 Warning from function _IELoadWait, $_IEStatus_LoadWaitTimeout
0053: 6-0: if @error == 0 Then
0056: 6-0:  TrayTip("Web Auto: Enable...", "Notice: Bad Security Certificate Detected attempting to bypass...", 5, 2)
0057: 0-0:  Send("!y")
0058: 0-0:  sleep(5000)
0059: 0-0: EndIf

so in theory if the window had still been active it would have continued <_< is there a better way to interact with a popup like this than to now seemingly shorten the Timeout?

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

grr yah setting _IELoadWaitTimeout (15000) did cause the Alt+y blind key send to click yes and thus cause the script to continue, but thats one crude way of doing things <_<( esp because I had orig hoped to have all of this run invis.

Edit: forgot to mention.. its WinXP running IE 6 Sp2

Edited by zhenyalix

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

grr yah setting _IELoadWaitTimeout (15000) did cause the Alt+y blind key send to click yes and thus cause the script to continue, but thats one crude way of doing things :)( esp because I had orig hoped to have all of this run invis.

Edit: forgot to mention.. its WinXP running IE 6 Sp2

The _IECreate() function does _IELoadWait() by default. You need to background it so your script can go on and deal with the popup:

TrayTip("Web Auto: Enable...", "Attempting to login to Foo as: " & @UserName, 5, 1)
$oIE = _IECreate ("https://SiteWithBadCert.net", 0, 1, 0) ; Note last parmeter

Do 
    $hWin = WinGetHandle("Title of Window", "Text of Window") 
    If Not @error Then
        TrayTip("CMS Auto: Enable...", "Notice: Bad Security Certificate Detected attempting to bypass...", 5, 2)
        ControlSend($hWin, "", "", "!y")
    EndIf
Until _IELoadWait($oIE, 0, 100)

<_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

awesome.. that seemed to fix it - for some reason the Do... Until _IELoadWait($oIE, 0, 100) seemed to hang the script after dealing with the popup (till the timeout ended then the script continued perfectly) but turning loadwait off / backgrounding it to deal with the popup then just running a _IELoadWait ($oIE) seems to deal with it perfectly...

thanks for the help!

Don't let that status fool you, I am no advanced memeber!

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