Sign in to follow this  
Followers 0

Issues with _IEAttach!

1 post in this topic

#1 ·  Posted (edited)

$RandomOne = "15"
$RandomTwo = "30"

$Site = _IECreateNew("" & $RandomOne & $RandomTwo)

;;;;;;;;;;;;;;;;;;;;Random Stuff, Then the AutoIt script clicks the submit button

_IEAction($Submit, "click")

;;;;;;;;;;;;;;;;;;The Page now reloads and I want to reattach

SecureSite = _IEAttach($RandomOne & $RandomTwo & "1 - Internet Explorer - [InPrivate]", "title")
;$SecureSite = _IEAttach("", "url")

;;; The commented out line works, but I don't want to attach via 'url' I want to attach via the title.


Func _IECreateNew($s_url = "about:blank", $invisible = 0)
    ; Create an IE browser in a new process, attach to it and navigate to specified URL
    ; Returns browser object on success
    ; Returns 0 on failure and sets @error to 1 (timeout waiting for browser)  or 2 (attach failed)

    Local $h_IEhandle, $o_IE
    Local $Random1 = Random(100000, 999999, 1)
    Local $Random2 = Random(100000, 999999, 1)
    Local $RunWebsite = Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe about:blank" & $Random1 & "-" & $Random2 & " -noframemerging -private")
    If $invisible Then
        _IEAction($RunWebsite, "invisible")

    If Not WinWait("Navigation Canceled - Internet Explorer - [InPrivate]", "", 60) Then ; Expected IE window did not appear
        Return SetError(1, 0, 0)

    ;$h_IEhandle = WinGetHandle("Navigation Canceled - Internet Explorer - [InPrivate]")
    $o_IE = _IEAttach("about:blank" & $Random1 & "-" & $Random2, "url")

    If Not IsObj($o_IE) Then ; attach failed
        Return SetError(2, 0, 0)

    _IENavigate($o_IE, $s_url)
    Return $o_IE
EndFunc   ;==>_IECreateNew

Why am I not able to attach via title?

This is what AutoIt WIndow Info shows

>>>> Window <<<<
Title:    15301 - Internet Explorer - [InPrivate]
Class:    IEFrame
Position:    564, 135
Size:    1191, 675
Style:    0x16CF0000
ExStyle:    0x00000100
Handle:    0x00290D12

Edited by Dgameman1

Share this post

Link to post
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
Sign in to follow this  
Followers 0