Jump to content

Problems with IE11 and Win10


 Share

Recommended Posts

Hello,

i search in the forum and on search-engines and i tried

all of the tips i found, but nothing works.

Maybe anyone of you could help me with all my problems.

My scripts runs on win8 and IE 10 and now i will upgrade to win 10.

My autoit versions:

3.3.10.1

3.3.12.*

3.3.14.5

I tried to deactivated the windows defender.

i tried to deactivate the uac.

I tried to uninstall the avast.

I tried this in the files

;#RequireAdmin

;$hIE = _IEPropertyGet($oIE, "hwnd")
;WinActivate($hIE)

;$oIE.navigate($sUrl)

;_IEErrorHandlerRegister(_User_ErrFunc)
;Opt("TrayAutoPause",0)
;Opt("TrayMenuMode",1) ; no default menu (Paused/Exit)

here my call in the command line:

1."C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "C:\...\openBrowserWin10.au3" https://www.google.com

2. "C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "C:\...\getAmznVoucherSrc.au3" 6300 //the pid from ie

 

here are my source:

openBrowser.au3

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.3.6.0
    
    Author:         myName
    
    Script Function: Template AutoIt script.
    
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <../api/incl.au3>

$sUrl = $CmdLine[1]

$iPid = _OpenNewBrowserWithNewSessionWin10()
Sleep(2000)
$oIE = _GetBrowserByPid($iPid)
Sleep(2000)
_IENavigate($oIE, $sUrl, 1)
Sleep(2000)

ConsoleWrite ('pid='& $iPid & @CRLF)

Func _OpenNewBrowserWithNewSessionWin10()
    Local $aWinList_Before = WinList("[CLASS:IEFrame]")
    Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe -noframemerging -private https://www.google.com")
    Do
        $aWinList_After = WinList("[CLASS:IEFrame]")
    Until $aWinList_After[0][0] > $aWinList_Before[0][0]
    Local $hwnd = $aWinList_After[1][1]
    Local $iPid = WinGetProcess($hwnd)
    Sleep(2000)
    Local $oIE = _GetBrowserByPid($iPid)
    
    _IELoadWait($oIE)
    
    Return $iPid
EndFunc

Func _GetBrowserByPid($iPid)
    If ProcessExists($iPid) = 0 Then
        Return null
    EndIf
    Local $oIE
    While 1
        $aWinList = WinList("[CLASS:IEFrame]")
        For $i = 1 To $aWinList[0][0]
            $iPid2 = WinGetProcess($aWinList[$i][1])
            ;ConsoleWrite ('pid2='& $iPid2 & @CRLF)
            If BitAND( WinGetState($aWinList[$i][1]), 15) AND $iPid = $iPid2 Then 

                $oIE = _IEAttach($aWinList[$i][1], "hwnd")
                ExitLoop 2
            EndIf
        Next
    WEnd
    Return $oIE
EndFunc

getAmznVoucherSrc.au3

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.3.6.0
    
    Author:         myName
    
    Script Function: Template AutoIt script.
    
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <../api/incl.au3>

$ibrowserPid = $CmdLine[1]

$oIE = _GetBrowserByPid($ibrowserPid)

$sUrl = "https://www.amazon.de/b?node=6005495031"

_IENavigate($oIE,$sUrl)

Sleep(2000)
$linkPart = "Beliebteste Coupons"

 Local $i = 0
 Local $tags = null
Do
    _IELinkClickByText($oIE, $linkPart)
    _IELoadWait($oIE)
    Sleep(10000)
    
    $tags = $oIE.document.GetElementsByClassName("vpc_coupon_grid_get_more_coupons")    
    $i += 1 
Until $i > 5 OR (Not @error And $tags.length > 0)
If Not @error Then
    $foundTag = $tags(0)
     For $i=1 To 10
        _IEAction($foundTag, "focus")
        _IEAction($foundTag, "click")
        _IELoadWait($oIE)
        Sleep(10000)
     Next
     
     $couponGrid = $oIE.document.GetElementsByClassName("vpc_coupon_grid_inner_grid")    
     
     ConsoleWrite ($couponGrid(0).innerHTML)
 EndIf
 
 Func _GetBrowserByPid($iPid)
    If ProcessExists($iPid) = 0 Then
        Return null
    EndIf
    Local $oIE
    While 1
        $aWinList = WinList("[CLASS:IEFrame]")
        For $i = 1 To $aWinList[0][0]
            $iPid2 = WinGetProcess($aWinList[$i][1])
            ;ConsoleWrite ('pid2='& $iPid2 & @CRLF)
            If BitAND( WinGetState($aWinList[$i][1]), 15) AND $iPid = $iPid2 Then 

                $oIE = _IEAttach($aWinList[$i][1], "hwnd")
                ExitLoop 2
            EndIf
        Next
    WEnd
    Return $oIE
EndFunc

 

I hope i give you enough information and you can give me a hint

to fix it.

 

 

Edited by diel2002
Link to comment
Share on other sites

Now I tried it with autoit 3.3.14.5 and open a new tab and closed the other.

And it works. But i think that i get the problems again.

I make another test and i got the same problem.

Ie.navigate seems to be the problem.

Could it be that the tab is killed or in sleep modus?

Has anybody an idea?

Edited by diel2002
Link to comment
Share on other sites

I just took a look at your code in openBrowser.au3.  It is kind of odd.  In the first function you search for handle that will bring you to the pid.  And in the second you search a handle based a pid, while in the first function you already had that handle.  How about streamlining your code like in the following :

#include <IE.au3>

Local $oIE = _OpenNewBrowser()
_IENavigate ($oIE, "amazon.ca")
_IELoadWait ($oIE)

Func _OpenNewBrowser()
  Local $aPid = ProcessList ("iexplore.exe")
  Run (@ProgramFilesDir & "\Internet Explorer\iexplore.exe -noframemerging -private https://www.google.com")
  Sleep (5000)
  Local $aWin = WinList("[CLASS:IEFrame]"), $bFound = False
  For $i = 1 To $aWin[0][0]
    For $j = 1 to $aPid[0][0]
      If WinGetProcess($aWin[$i][1]) = $aPid[$j][1] Then ContinueLoop 2
    Next
    Local $hwnd = $aWin[$i][1]
    $bFound = True
    ExitLoop
  Next
  If Not $bFound Then Exit MsgBox($MB_SYSTEMMODAL, "", "Unable to find IE handle")
  Local $oIEatt = _IEAttach($hwnd, "hwnd")
  If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Unable to attach IE")
  Return $oIEatt
EndFunc   ;==>_OpenNewBrowser

 

 

Link to comment
Share on other sites

@Nine

Thank you for you reply.

But my code to get the right pid works. In Win 10 it is different.

It exists a parent and a child process. It was a long search period to get the right code

that it works and i can get the right pid for the ie.

it seems that the tab stops responding after some time and therefore i can not navigate anymore.

Edited by diel2002
Link to comment
Share on other sites

Yes I tested my code on win10 and it works great.  Have you tested it ?  I think it is more comprehensive. But you may prefer yours. :)

If navigate stop working after awhile, try to run your script using x64

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