Jump to content
DougShields

Bug in IE.au3 or in IE ?

Recommended Posts

DougShields

Some of my users are having trouble that I confirmed happens "just for them".  Specifically _IEFormElementRadioSelect returns $_IESTATUS_NoMatch for a radio button that clearly exists in the page.  For me using WinXP / IE8 or Win8.1 / IE11 I see few if any symptoms, but when I put together a test on their Win 7 / IE8 platform sure enough it breaks.  The unit test is just a bit of code that changes a radio box value, which triggers a postback, waits for the postback to complete, and repeats with a new value, triggering another postback, repeat 1000 times and call it success.  After some debugging I determined that _IEFormElementGetObjByName was finding the radio button, but _IEFormElementRadioSelect was not, which lead to this bit of code from IE.au3:

Local $oItems = Execute("$oObject.elements('" & $sName & "')")

Which looks valid and works some (maybe even most) of the time on Win 7 / IE 8.  So I modified it to use the similar construct from _IE_FormElementGetObjByName to be:

Local $oItems = $oObject.elements.item($sName)

Which works 100% for me.  So the question now becomes, is this a beta issue, an IE.au3 issue, or an IE issue?  The only real difference is where I place my code to workaround cases where Win 7 / IE8 / _IEFormElementRadioSelect don't do what was expected.

Share this post


Link to post
Share on other sites
Sindaugh

Hello,

I do have the above problem of getting a error:7 extended:3, but the fix does not work. When I replace as instructed to this:

$sName = String($sName)

;Local $oItems = Execute("$oObject.elements('" & $sName & "')")
Local $oItems = $oObject.elements.item($sName)

If Not IsObj($oItems) Then
__IEConsoleWriteError("Warning", "_IEFormElementRadioSelect", "$_IESTATUS_NoMatch")
Return SetError($_IESTATUS_NoMatch, 3, 0)
EndIf

my script starts running, but fails at the line

Local $oItems = $oObject.elements.item($sName)

with the following error:

 56bc83a86fe0e_11-02-201612-00-32.jpg.bf4

Funnily enough, when I access form elements directly from my script as

$oElements = $thisForm.elements.item("removeBsKey")

it works. I am really stuck.

On a side note - it worked fine in August '15 with a very old version, but I do not know what my IT did to my machine to change the behaviour.

 

Thanks a lot.

Steven

Share this post


Link to post
Share on other sites
mLipok

Are you using COM Error Handler ?
If no then please look here:  How to use IE.au3  UDF with  AutoIt v3.3.14.x  

 

As a quick (note tested) work around try to use this:

$oElements_coll = $thisForm.elements
if Not @error Then
    $oElements_coll.item("removeBsKey")
EndIf

 

EDIT: which AutoIt version you are using ?

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
Sindaugh

Version should be the latest as I re-downloaded today. I am not sure how to determine the version as I did not install, but use the "just run it" version.

I now set the error handler as described. The error in IE.au3 for .elements is gone, but now i am getting the NoMatch again. So it may be my fault (again).

 

Script Code:

;I already started with an IE instance in $oIE and did some stuff to it that worked, so the instance is fine
$thisForm = _IEFormGetObjByName($oIE, "assignmentForm")

; $thisForm is also working or I would be getting an error 1 from IE.au3
_IEFormElementRadioSelect($thisForm, 1137, "removeBsKey")

Still I get @error: 7, @extended: 3

HTML:

<form name="assignmentForm" method="post" action="/spin/assignmentRemove.do"><input type="hidden" name="org.apache.struts.taglib.html.TOKEN" value="d51da33b-b170-4d15-9511-0fd49da5af02">
    <input type="hidden" name="submitCommand" value="">
    <input type="hidden" name="primaryKey" value="OBFUSCATED">

    <table width="100%" border="0" cellspacing="0" cellpadding="3">
        <tr>
            <td class="ctPageTitle">BS to remove</td>
        </tr>
    </table>
    <table border="0" cellpadding="3" cellspacing="0" width="100%">
        <tr>
            <td class="ctEntryText">&nbsp;</td>
        </tr>
    </table>
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td width="100%" valign="top">
    <table cellspacing="0" cellpadding="0" border="0" width="100%" class="ctTabStripLine">
      <tr>
                      <td align="right" width="24"><img src="/spin/images/TabStripLeftOff.gif"  width="24" height="19" alt=""></td>
                      <td nowrap height="19" class="ctTabStripTextOffDisabled">
                        Details
                      </td>
                      <td align="right" width="24"><img src="/spin/images/TabStripOffOff.gif"  width="24" height="19" alt=""></td>
                      <td nowrap height="19" class="ctTabStripTextOffDisabled">
                        Admin Data
                      </td>
                      <td align="right" width="24"><img src="/spin/images/TabStripOffOff.gif"  width="24" height="19" alt=""></td>
                      <td nowrap height="19" class="ctTabStripTextOffDisabled">
                        Structure
                      </td>
                          <td align="right" width="24"><img src="/spin/images/TabStripOffOn.gif"  width="24" height="19" alt=""></td>
                <td nowrap height="19" class="ctTabStripTextOn">
                      Business Services
                </td>
                      <td align="right" width="24"><img src="/spin/images/TabStripRightOn.gif"  width="24" height="19" alt=""></td>
                <td width="100%"><img src="/spin/images/blank.gif" width="1" height="1" alt=""></td>
      </tr>
    </table>
</td>
        </tr>
    </table>
    <table width="100%" border="0" cellspacing="1" cellpadding="3">
        <tr>
            <td class="ctTblDark">7 Business Services are available</td>
        </tr>
    </table>
    <table width="100%" border="0" cellspacing="1" cellpadding="3">
        <tr>
            <td class="ctTblMediumBold">&nbsp;</td>
            <td class="ctTblMediumBold">Display Name</td>
                <td class="ctTblMediumBold">Technical Name</td>
                <td class="ctTblMediumBold">Assignment for</td>
                <td class="ctTblMediumBold">Assigned To</td>
            <td class="ctTblMediumBold">Description</td>
                <td class="ctTblMediumBold">UM GroupName</td>
        </tr>
            <td class="ctTblWhite" valign="top"><input type="radio" name="removeBsKey" value="1137" checked="checked"></td>
            <td class="ctTblWhite" valign="top">AirSupply_CG</td>
                <td class="ctTblWhite" valign="top">AS_CG</td>
                <td class="ctTblWhite" valign="top">
                Buyer<br>
                Seller
                </td>
                <td class="ctTblWhite" valign="top">
                CG<br>
                </td>
            <td class="ctTblWhite" valign="top">Used for Corporate Group Name display in AS Application only - no further functionalities</td>
                <td class="ctTblWhite" valign="top"></td>
            </tr>
            <td class="ctTblLight" valign="top"><input type="radio" name="removeBsKey" value="1078"></td>
            <td class="ctTblLight" valign="top">CMS_Sync</td>
                <td class="ctTblLight" valign="top">CMS_Sync</td>
                <td class="ctTblLight" valign="top">
                Buyer<br>
                Seller
                </td>
                <td class="ctTblLight" valign="top">
                LE
                </td>
            <td class="ctTblLight" valign="top"></td>
                <td class="ctTblLight" valign="top"></td>
[...]

The page starts earlier and goes on with more radio options in the group, but I think you will get the idea. I know that in this example the radio I want to check is already preselected. Nevertheless this may not be the case and I want to make 100% it is selected.

 

Thanks a lot!

Share this post


Link to post
Share on other sites
Sindaugh

Oh my god... I am soooo silly.

I forgot the _IELoadWait($oIE) after I clicked a button. Now it is working.

Sorry for the trouble.

 

Thanks for all the help

Share this post


Link to post
Share on other sites
mLipok

You're welcome.

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

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

    • FMS
      By FMS
      Hello,
      I try to get all the text from a news site around a subject.
      The first run I get all the text inside a attribute in an array.
      When i try to go back and reload another page it chrashes and think it because "$oIE.GoBack"
      I couldn't find anything in the help/forum around this subject.
      Do I need to reload the $oIE or something afther an X.GoBack?
      The error i got is :
      if $oTag2.GetAttribute("class") == "NewsDetail" Then if $oTag2^ ERROR I'm not shure why I got this error, maybe someone could explain?
      Also I'm open for some pointers in this test script because I'm pretty new in working whit the IE.UDF
      Maybe there is an simpler way to get the same results?

      test script:
      #include <IE.au3> #include <MsgBoxConstants.au3> #include <Array.au3> HotKeySet("{ESC}", "Terminate") Global $oIE = _IECreate("https://www.iex.nl/Zoeken/Nieuws.aspx?q=air%20france") ;get first subject Global $oLink1 = _IEGetObjById($oIE, "ctl00_ctl00_Content_LeftContent_NewsSearch_repNews_ctl00_linkNews") Sleep(500) _IEAction($oLink1, "click") Sleep(500) Global $oTags = _IETagNameGetCollection($oIE, "div") Global $aResults[1] For $oTag In $oTags if $oTag.GetAttribute("class") == "NewsDetail" Then _ArrayAdd($aResults, $oTag.innerTEXT) EndIf Next $aResults[0] = UBound($aResults) - 1 _ArrayDisplay($aResults, "Episodelist") ConsoleWrite($aResults[1] & @CRLF) $oIE.GoBack ;get second subject Global $oLink2 = _IEGetObjById($oIE, "ctl00_ctl00_Content_LeftContent_NewsSearch_repNews_ctl01_linkNews") Sleep(500) _IEAction($oLink2, "click") Sleep(500) Local $oTags2 = _IETagNameGetCollection($oIE, "div") Local $aResults2[1] For $oTag2 In $oTags2 if $oTag2.GetAttribute("class") == "NewsDetail" Then _ArrayAdd($aResults2, $oTag2.innerTEXT) EndIf Next $aResults2[0] = UBound($aResults2) - 1 ConsoleWrite($aResults2[1] & @CRLF) Func Terminate() _IEQuit($oIE) Exit EndFunc ;==>Terminate  
    • SkysLastChance
      By SkysLastChance
      I am having a hard time understanding why this is not working. I was hoping some one could help explain it to me. 
      $tags = $oIE.document.GetElementsByTagName("input") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "fTs-p3298-l0 wplEditControl" Then $target = $tag ExitLoop EndIF Next MsgBox(0,"",$target) If $target = "fTs-p3298-l0 wplEditControl" THEN MsgBox(0,"","itworked") I have tried 
       MsgBox(0,"",$target.Attribute)  MsgBox(0,"",$target.Value)  MsgBox(0,"",$target.InnerText) I would expect to see this in the msgbox
      fTs-p3298-l0 wplEditControl  
    • SkysLastChance
      By SkysLastChance
      I am trying to grab the id "in2xk_26" however it the characters before the underscore always change. (in the name too)
      Is there a way I can find a id or name by the last 3 charcters?
      Using something like "stringright?"
      So I would want to search for just "_26" in this case.
      This is assuming that there are no other _26
       

      #include <Excel.au3> #include <IE.au3> #include <GUIConstantsEx.au3> Global $iMousespeed = 25,$target = "",$TagName = "",$Value = "",$Atrribute = "" $oIE = _IEAttach("MEDITECH") $TagName = "input" $Value = "in2xk_26" $Attribute = "id" $tags = $oIE.document.GetElementsByTagName($TagName) ;TagName ------ MAKE SURE TO NAME THESE For $tag in $tags $class_value = $tag.GetAttribute($Attribute) ;Attribute ------ MAKE SURE TO NAME THESE If string($class_value) = $Value Then ;Value ------ MAKE SURE TO NAME THESE $target = $tag $iScreenX = _IEPropertyGet($target, "screenx") $iScreenY = _IEPropertyGet($target, "screeny") $iWidth = _IEPropertyGet($target, "width") $iHeight = _IEPropertyGet($target, "height") $oMouseCords = MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed) MouseClick($MOUSE_CLICK_LEFT) ExitLoop EndIf Next  
       
    • SkysLastChance
      By SkysLastChance
      I was wondering how I read data inside of a iframe. I would like to be able to click something inside a iframe. However, I can't even find the tag. 
      The id and name change all the time so I can't use those. 
      The code highlighted in blue is what I am trying to click. (second picture)
      Here is what I have tried.
      $target = "" $tags = $oIE.document.GetElementsByTagName("div") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "s_92 altstyle s_93 s_94" Then $target = $tag ConsoleWrite("Tag Found " & $target.outerText&@CRLF) ExitLoop EndIf Next  

       
       

    • MakzNovice
      By MakzNovice
      Hello Experts,
      I am working on modifying table data of a browser currently in IE (soon in FF)
      My sequence of operations:
      1. Activate Browser
      2. Get Browser table
      3. Modify data  in table
      4. Suppress any warning/error message from webpage
      5. Activate the Webpage again 
      6. Send {F11} key sequence twice to achieve some update without Updating form ( {F5})
       
      My problem is at Step 5, as it activates the wrong window ( last used application rather than my browser window)
      My code snippet for it as follows
      $bFoundWindow = False Local $aList = WinList("[REGEXPTITLE:(?i)(.*Internet Explorer.*)]") Local $hWND = 0 For $i = 1 To $aList[0][0] If False = $bFoundWindow And $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 1) Then WinActivate($aList[$i][1]) ; 1. Activate Browser window WinSetState ( $aList[$i][1], "", @SW_MAXIMIZE) $hWND = $aList[$i][1] $objEditIE = _IEAttach ($aList[$i][1], "hwnd") $oTitles = _IETagNameGetCollection($objEditIE, "TITLE") For $oTitle In $oTitles $sTitle = $oTitle.innerText If $sTitle = $searchString Then MsgBox(0,"APPLICATION Found", "Got Edit List Window", 1) $bFoundWindow = True ExitLoop EndIf Next EndIf Next If False = $bFoundWindow Then MsgBox(0,"Error","Please launch Edit window for updating values in Browser prior to script execution",10) Exit EndIf ; MY CODE HERE TO MODIFY TABLE ; 2. Get Browser table ; 3. Modify data  in table ; Check if message from webpage pop-up window exists if so click ok on it Local $nCounter = 0 Local $nMaxCounter = 5 while 1 If WinExists("Message from webpage","") Then ControlClick("Message from webpage","","Button1","primary",1) ;4. Suppress any warning/error message from webpage Else $nCounter = $nCounter + 1 Sleep(100) ;MsgBox(0,"Counter", $nCounter, 1) If $nCounter = $nMaxCounter Then ExitLoop EndIf WEnd ;5. Activate the Webpage again  WinActivate($hWND) ; have already tried WinActivate($aList[$i][1]) but no success ;6. Send {F11} key sequence twice to achieve some update without Updating form ( {F5}) Send("{F11}") WinActivate($hWND) ;WinActivate($aList[$i][1]) Sleep(100) Send("{F11}") Any support will be highly appreciated
×