Jump to content
TheDcoder

Embedded IE fails to load webpage

Recommended Posts

Hello everyone,

I encountered this strange issue while working on a freelance project, I cannot give you the webpage/website on which this is happening because it is an internal site which is inaccessible externally. I am attempting to create a GUI with an IE control embedded in it, but when I navigate to the desired address, it shows a blank white page.

The webpage does load if I use a different browser or normal (non-embedded) IE instance.

I managed to get my hands on the source of the blank page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

    <head>
        <link rel="stylesheet" type="text/css" href="res://ieframe.dll/ErrorPageTemplate.css" />

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

        <title>Navigationen blev annulleret</title>

        <script src="res://ieframe.dll/errorPageStrings.js" language="javascript" type="text/javascript">
        </script>
        <script src="res://ieframe.dll/httpErrorPagesScripts.js" language="javascript" type="text/javascript">
        </script>
    </head>

    <body onLoad="javascript:navCancelInit(); ">

        <table width="730" cellpadding="0" cellspacing="0" border="0">

        <!-- Error title -->
            <tr>
                <td id="infoIconAlign" width="60" align="left" valign="top" rowspan="2">
                    <img src="res://ieframe.dll/info_48.png" id="infoIcon" alt="Oplysningsikon">
                </td>
                <td id="mainTitleAlign" valign="middle" align="left" width="*">
                    <h1 id="mainTitle">Navigationen til websiden blev annulleret</h1>
                </td>
            </tr>



            <tr>
                <!-- This row is for HTTP status code, as well as the divider-->
                <td id="errorCodeAlign" class="errorCodeAndDivider" align="right">&nbsp;
                    <div class="divider"></div>
                </td>
            </tr>


        <!-- Error Body -->

        <!-- What you can do -->
            <tr>
                <td>
                    &nbsp;
                </td>
                <td id="whatToTryAlign" valign="top" align="left">
                    <h2 id="whatToTry">Prøv at:</h2>
                </td>
            </tr>

        <!-- refresh page -->
            <tr>
                <td >
                    &nbsp;
                </td>
                <td id="refreshPageAlign" align="left" valign="middle">
                    <h4>
                        <table>
                          <tr>
                              <td valign="top">
                                  <img src="res://ieframe.dll/bullet.png" border="0" alt="" class="actionIcon">
                              </td>
                              <td valign="top">
                                  <span id="navCancelContainer"></span><noscript id="refreshPage">Opdatere siden.</noscript>
                              </td>
                          </tr>
                        </table>
                    </h4>
                </td>
            </tr>
        </table>
    </body>
</html>

The ieframe.dll resources are a point of interest. I am not sure how the server is able to detect the embedded instance of IE :unsure:...

Any suggestions? Here is a basic outline of the script:

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

While True
    Sleep(1000)
WEnd

Func Main()
    ; Create GUI
    $hGUI = GUICreate("", $GUI_WIDTH, $GUI_HEIGHT, $iLeft, $iTop, $WS_POPUP)
    $oIE = _IECreateEmbedded()
    ;$oIE = _IECreate() ; This works, but it is not embedded in the GUI
    GUICtrlCreateObj($oIE, 0, 0, $GUI_WIDTH, $GUI_HEIGHT)
    GUISetState()

    ; Navigate to the URL and authenticate
    _IENavigate($oIE, $URL)
EndFunc

Thank you for the advice in advance!


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

@TheDcoder
In the Help file it is stated to set the style $WS_CLIPCHILDREN to the GUI, since there may be visualization issue without that style.
Does the script return any error after functions calling? :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
On 5/2/2019 at 3:04 PM, FrancescoDiMuro said:

In the Help file it is stated to set the style $WS_CLIPCHILDREN to the GUI, since there may be visualization issue without that style.

It did indeed help! Instead of the white blank page it did show an error when I added the style: "Navigation was cancelled" (or something along those lines).

What really fixed the issue was navigating to about:blank before performing any other actions (including navigation), so the working code looks a bit like this:

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

While True
    Sleep(1000)
WEnd

Func Main()
    ; Create GUI
    $hGUI = GUICreate("", $GUI_WIDTH, $GUI_HEIGHT, $iLeft, $iTop, $WS_POPUP + $WS_CLIPCHILDREN)
    $oIE = _IECreateEmbedded()
    ;$oIE = _IECreate() ; This works, but it is not embedded in the GUI
    GUICtrlCreateObj($oIE, 0, 0, $GUI_WIDTH, $GUI_HEIGHT)
    GUISetState()

    ; Initialize by navigating to about:blank
    _IENavigate($oIE, 'about:blank')

    ; Navigate to the URL and authenticate
    _IENavigate($oIE, $URL)
EndFunc

Navigating to about:blank was indeed mentioned in the helpfile, but it only stated that we "must therefore use _IENavigate() to navigate this browser to 'about:blank' after it has been embedded into the parent application and before you attempt any operations that rely on having a document loaded (e.g. _IEBodyWriteHTML())". I did notice it initially when I was writing code, but I decided to navigate directly to the URL since I did not have to perform any operations relying on having a document loaded... now guess other operations are effected too :think:

 

On 5/2/2019 at 6:22 PM, Danp2 said:

Could the issue be the result of the embedded browser version using a very old version of IE? I vaguely recall a thread where you can adjust this, but you'll need to locate it on your own. 😉

Not really sure about that as I am pretty sure only one version of IE is present in an installation of Windows. Thanks for the tip but I have fixed my issue by navigating to about:blank first :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
11 minutes ago, TheDcoder said:

I did notice it initially when I was writing code, but I decided to navigate directly to the URL since I did not have to perform any operations relying on having a document loaded... now guess other operations are effected too :think:

Exactly!
It doesn't seem to affect any other "action" less the automatic navigation to the about:blank; by the way, happy to have helped (even if a little bit) :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

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

  • Similar Content

    • By WoodGrain
      Hi All,
      I've tried to create a script to browse to a web page in IE, but it only works for some sites, I've tried to simplify the script as much as possible, hoping you can point me in the right direction - thanks.
      This one going to Google does work:
      #include <IE.au3> $oIE = _IECreate("https://www.google.com.au/", 0, 1, 1) _IELoadWait($oIE) _IEQuit($oIE) But this one going to OneDrive opens the IE page, but fails immediately returning the errors, and the IE window is not closed:
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023174, Browser has been deleted prior to operation.)
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
      --> IE.au3 T3.0-2 Error from function _IEQuit, $_IESTATUS_InvalidObjectType
      #include <IE.au3> $oIE = _IECreate("https://abccorp-my.sharepoint.com/", 0, 1, 1) _IELoadWait($oIE) _IEQuit($oIE) Even if I put a sleep timer in for 10 seconds after the _IECreate it still doesn't work
      Thanks all!
    • By Dent
      https://rmplusportal.rightmove.co.uk/
      On that page is a login form requiring username, password and then the clicking of the button (or pressing enter but I'm not a fan of using Send)
      Here's the section of code from the page that specifically deals with the form...
      <form> <div class="error-message-login" data-test="error-message"></div> <label> <span>User email</span> <div class="ui input"> <input id="email" type="text" placeholder="Your email"> </div> </label> <label> <span>Password</span> <div class="ui input"> <input id="password" type="password" placeholder="Password"> </div> </label> <button class="ui primary button" role="button" data-test="login">Login</button> <p> <a class="forgot-your-password" href="https://www.rightmove.co.uk/forgottenPasswordForm.html">Forgot your password?</a> </p> </form> Specifically the <button class...></button> is causing me problems as I can't find a way to click it. The 'User email' and 'Password' objects have an 'id' so I can reference these in the AutoIT code and interact with them and the button also previously had the id of 'login' but I guess in a change to this page that was altered.
      Oddly, if I get the code to show the instance of IE that is created and manually click Login or press Enter the page gives me an error saying 'Please enter your email address' even though it is there. I have to manually go into each field and make a change i.e. adding a character to the end of each field then deleting it before it will let me in by either clicking Login or pressing enter. So maybe there's so code elsewhere on the page that knows the fields haven't been physically typed in?
      Any help on this would be much appreciated.
    • By Elizabeth
      Buttons on GUI to perform different tasks. SETUP is a task that involves displaying another GUI, doing calculations, writing lines to 2 external files, displaying information on GUI labels.  The info from the displayed GUI (quantity made and job completed YES or NO) must be included on the written lines. I cannot get the script to run synchronously (waterfall execution 1st one ends before 2nd one starts.) That means lines written to the files do not contain the required data.  I have read through FORUM and thought by inserting a boolean value and changing TRUE FALSE that I could solve this issue. I would have to set/reset the boolean before every function call to make it work. I've tried using Sleep but that just slows everything down and makes main GUI look unresponsive
      Is there a trick or tip someone can provide that forces synchronous execution?
      I am using OPT GUIOnEventMode
      Thank you for any insight into this issue.
    • By JackER4565
      Hi, first of all thanks to all the guys who always help people in the forums, I wouldn't be able to do anything if wasn't for your help, even if I don't ask it myself.
       
      I've created this code to get some info on a monitoring network on my work. It relays on _IETableGetCollection and _IETableWriteToArray.
      It works well, but take around 3:25 minutes to get the info from 28 pages (some of them are large and take longer to load, but most of them are small and fast).
      My question is if you see a way to get the program to go faster...
       
      I've tried to make it easy for you to understand and edited somethings with sensitive info.
      (Some of the pages doesn't have the black divider with MIRA in the end, so I need to search if it is there or not.)
       
      #include <IE.au3> #include <array.au3> Local $oIE = _IECreate("about:blank", 0, 0) Local $paginas[28] = [89, 90, 91, 92, 93, 96, 105, 113, 119, 125, 126, 129, 131, 133, 135, 137, 139, 140, 141, 144, 145, 146, 148, 149, 150, 151, 158, 159] Local $Datos_array[0][2] Local $oTable Local $tabla Local $aux_x = 1 Local $ar = 1 Local $Numtables_datos = 0 MsgBox(0, "asd", "asd") For $pag = 0 To UBound($paginas) - 1 Step 1 _IENavigate($oIE, "<WEBSITE URL>" & $paginas[$pag]) ; <<< the pages to load are always the same except for the last digits. _ArrayAdd($Datos_array, $paginas[$pag] & "|" & "Entrante", 0, "|") ; <<<<<<<<<<<<<<<< adds the page number toarray [0, 0] ;############################################ START counts amount of tables with traffic $oTable = _IETableGetCollection($oIE) Local $iNumTables = @extended For $i = 3 To $iNumTables - 2 Step 1 $oTable = _IETableGetCollection($oIE, $i) $nomb_tabla2 = _IETableWriteToArray($oTable) ; <<<<<<<< TABLE TO ARRAY. $string2 = StringStripWS($nomb_tabla2[1][0], 8) If $string2 <> "MIRA" Then $Numtables_datos = $Numtables_datos + 1 Next $tabla_End = $iNumTables - $Numtables_datos ;############################################ FIN $tabla_Start = 4 $tabla_trafico = 2 For $for = 1 To $Numtables_datos Step 1 $oTable = _IETableGetCollection($oIE, $tabla_Start - 1) ; <<<<<<<<<<< NAME OF THE TABLE; row2 = mira $nomb_tabla = _IETableWriteToArray($oTable) ; <<<<<<<< TABLE TO ARRAY ;########################################### ADDS the traffic number into the row $string = StringStripWS($nomb_tabla[1][0], 8) If $string == "MIRA" Then ;si o si pasa por aca 1 vez _ArrayAdd($Datos_array, $nomb_tabla[0][0]) $nomb_aux = $nomb_tabla[0][0] $aux_x = 1 $tabla_trafico = $tabla_trafico + 2 Else ;esto deberia ser por row _ArrayAdd($Datos_array, $nomb_aux & " " & $aux_x) $aux_x = $aux_x + 1 $tabla_trafico = $tabla_trafico + 1 EndIf $oTable = _IETableGetCollection($oIE, $tabla_trafico) Local $aTableData = _IETableWriteToArray($oTable) $bps = _ArrayToString($aTableData, "|", 0, 0, @CRLF, 0, 0) $bps = StringRight($bps, 5) $bps = StringLeft($bps, 4) $trafico_actual = _ArrayToString($aTableData, "|", 0, 0, @CRLF, 2, 2) If $bps == "Gbps" Then $trafico_actual = $trafico_actual * 1000 If $bps == "Kbps" Then $trafico_actual = $trafico_actual / 1000 $Datos_array[$ar][1] = $trafico_actual $ar = $ar + 1 If $string == "MIRA" Then $tabla_Start = $tabla_Start + 2 Else $tabla_Start = $tabla_Start + 1 EndIf Next $ar = $ar + 1 ;~ ############# CAÍDA ############ ;~ If $actual_entrante = 0 Then ;~ $xxx = 0 ;~ Do ;~ MsgBox(0, "Tráfico Caído", $paginas[$i], 5) ;~ $xxx = $xxx + 1 ;~ Until $xxx = 10 ;~ EndIf ;~ ############# CAÍDA ############. Local $Numtables_datos = 0 Next _ArrayDisplay($Datos_array, "Array display") _IEQuit($oIE) Thanks!! 


      monitoria.html
    • By Dent
      Here is the URL to get to the page with the code as shown in the screenshot https://www.rightmove.co.uk/house-prices/detail.html?country=england&locationIdentifier=POSTCODE^1603593&searchLocation=SW1V+1AA&year=1&referrer=listChangeCriteria
      But how do I select the highlighted text, the address?
      I've tried variations of the below code but to no avail so far
      Local $oClassReturn = $oIE.document.getElementsByClassName("soldList") If Not IsObj($oClassReturn) Then Exit ConsoleWrite("Error in $oClassReturn" & @CRLF) Local $oTagReturn = $oClassReturn.Item(0).getElementsByTagName("div") If Not IsObj($oTagReturn) Then Exit ConsoleWrite("Error in $oTagReturn" & @CRLF) MsgBox(0, "TEST", $oTagReturn.Item(0))  

×
×
  • Create New...