Sign in to follow this  
Followers 0
complexjunk

Latest _IEFrameGetObjByName now returns $_IEStatus_NoMatch

5 posts in this topic

#1 ·  Posted (edited)

I'm struggling to get my code working in the latest IE.au3 (3.3.9++) that came with the newest stable version of AutoIt (v3.3.10.2). There's an old, but perfect example DaleHohm >posted that illustrates the problem:

 

...true, iframe is not a normal frame, but it is included in the frames collection and can be accessed with this function. Here is an example:

#include <ie.au3>
; Create browser window with an iframe
$oIE = _IECreate()
Sleep (3000); sleep needed with IE.au3 T1.4 and below
_IEBodyWriteHTML($oIE, "<h1>Test</H1><p><iframe src='about:blank' id ='foo'></iframe>")

; Get reference to iframe named foo and write to it
$oFrame = _IEFrameGetObjByName($oIE, "foo")
_IEBodyWriteHTML($oFrame, "hi"); string appears in frame

Dale

 

From the debug console:

IE.au3 T3.0-1 Warning from function _IEFrameGetObjByName, $_IEStatus_NoMatch (No frames matching name)

When I reverted to an older IE.au3 (3.3.7.20++), everything worked as expected.

Searched the forums, looked at the update history in the IE.au3 header, nothing's jumping out at me that I need to do differently to get this to work with the latest Include. Any ideas?

Edit: I tried to use the latest beta version's IE.au3 (3.3.10.0) and noticed that debugging was turned on, this is the result:

@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 266
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3054
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3024
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 441
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3039
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3054
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3024
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 459
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 1935
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 3054
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 3024
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 1607
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3039
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3054
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3024
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 441
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 3039
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 3054
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 3024
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 3041
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 459
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 490
@@ Debug(3026) : $Name_IEIsObjType = HTMLDocument
>Error code: 0    $ScriptLineNumber = 521
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 693
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3039
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3054
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 3024
@@ Debug(3026) : $Name_IEIsObjType = IWebBrowser2
>Error code: 0    $ScriptLineNumber = 698
@@ Debug(3026) : $Name_IEIsObjType = HTMLWindow2
>Error code: 0    $ScriptLineNumber = 1793
@@ Debug(3026) : $Name_IEIsObjType = HTMLWindow2
>Error code: 0    $ScriptLineNumber = 3039
@@ Debug(3026) : $Name_IEIsObjType = HTMLWindow2
>Error code: 0    $ScriptLineNumber = 3054
@@ Debug(3026) : $Name_IEIsObjType = HTMLWindow2
>Error code: 0    $ScriptLineNumber = 1799
@@ Debug(3026) : $Name_IEIsObjType = HTMLWindow2
>Error code: 0    $ScriptLineNumber = 3054
@@ Debug(3026) : $Name_IEIsObjType = HTMLWindow2
>Error code: 0    $ScriptLineNumber = 1777
--> IE.au3 T3.0-1 Warning from function _IEFrameGetObjByName, $_IEStatus_NoMatch (No frames matching name)
--> IE.au3 T3.0-1 Error from function _IEBodyWriteHTML, $_IEStatus_InvalidDataType

I turned on debugging ($__IEAU3Debug = True) with the older version (3.3.7.20++) that still works... but it gives some interesting errors:

--> COM Error Encountered in ie_scratch_test.au3
----> $IEComErrorScriptline = 3690
----> $IEComErrorNumberHex = 80020006
----> $IEComErrorNumber = -2147352570
----> $IEComErrorWinDescription = Unknown name.
----> $IEComErrorDescription = 
----> $IEComErrorSource = 
----> $IEComErrorHelpFile = 
----> $IEComErrorHelpContext = 
----> $IEComErrorLastDllError = 0


--> COM Error Encountered in ie_scratch_test.au3
----> $IEComErrorScriptline = 3690
----> $IEComErrorNumberHex = 80020006
----> $IEComErrorNumber = -2147352570
----> $IEComErrorWinDescription = Unknown name.
----> $IEComErrorDescription = 
----> $IEComErrorSource = 
----> $IEComErrorHelpFile = 
----> $IEComErrorHelpContext = 
----> $IEComErrorLastDllError = 0

I was hoping someone could confirm with the replicator whether or not it works for them in the latest stable AutoIt. If the script works, the text box below "Test" should say "hi" instead of being blank. I'm using Windows 8.1 that comes with IE11. Running it as admin did not change the result. Thanks!

Edited by complexjunk

Share this post


Link to post
Share on other sites



I hate to bump, but my last edit added a lot more debug info. Can someone try the example script and report whether or not they have the same issue? Thanks!

Share this post


Link to post
Share on other sites

Use this one instead:

_IEGetObjById

Also, my signature does the work of picking out the proper function for you (first link)...all you need is a "xpath" to the object.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Use this one instead:

_IEGetObjById

Also, my signature does the work of picking out the proper function for you (first link)...all you need is a "xpath" to the object.

 

Looking at your xpath thing... I'm not having any luck with it. Things seem to behave as expected when they're not in an iFrame, I think that's the main problem I'm having. How does the test script behave for you?

Also, I can access the iFrame with _IEGetObjById, but nothing inside it.

Edited by complexjunk

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I've finally figured out what's wrong with my old code not running on the new AutoIt with the new IE.au3:

The old version of IE.au3 had a bug/feature that allowed you to use _IEFrameGetObjByName on frames/iframes by either their name or id tag. The new version only works if there's a name tag, and won't match by id tag. Unfortunately, I need to access a frame that's only referred to by id tag. 

jdelaney's suggestion _IEGetObjByID does not seem to work on frames or iframes... and if there was a name tag for the frame, you would use _IEFrameGetObjByName over _IEGetObjByNAme... But, there isn't an official _IEFrameGetObjByID yet.

The only way you can access it now is by _IEFrameGetCollection or there's also a UDF available: >_IEFrameGetObjByID...

Examples:

; Old code based on http://www.autoitscript.com/forum/topic/23752-issue-with-iframe/?p=168616
#include <IE.au3>
$oIE = _IECreate()
_IEBodyWriteHTML($oIE, "<h1>Test</H1><p><iframe src='about:blank' id ='foo'></iframe>"); iframe only uses ID tag
$oFrame = _IEFrameGetObjByName($oIE,"foo"); Only works on older IE.au3 that would take id or name tags.
_IEBodyWriteHTML($oFrame, "hi") ; Fails to change frame on newer versions of IE.au3

; Solution
#include <IE.au3>
$oIE = _IECreate()
_IEBodyWriteHTML($oIE, "<h1>Test</H1><p><iframe src='about:blank' id ='foo'></iframe>"); iframe only uses ID tag
$oFrame = _IEFrameGetCollection($oIE,0) ; Works!
_IEBodyWriteHTML($oFrame, "hi")

; jdelaney's suggestion for using _IEGetObjById
#include <IE.au3>
$oIE = _IECreate()
_IEBodyWriteHTML($oIE, "<h1>Test</H1><p><iframe src='about:blank' id ='foo'></iframe>"); iframe only uses ID tag
$oFrame = _IEGetObjById($oIE,"foo"); No errors, but...
_IEBodyWriteHTML($oFrame, "hi"); writes over entire page instead of iframe

; Alternate scenario with name tag using _IEFrameGetObjByName
#include <IE.au3>
$oIE = _IECreate()
_IEBodyWriteHTML($oIE, "<h1>Test</H1><p><iframe src='about:blank' name ='foo'></iframe>"); Changed ID tag to name tag
$oFrame = _IEFrameGetObjByName($oIE,"foo"); Works because there's a name tag on the iframe
_IEBodyWriteHTML($oFrame, "hi")

; Alternate scenario with name tag using _IEGetObjByName
#include <IE.au3>
$oIE = _IECreate()
_IEBodyWriteHTML($oIE, "<h1>Test</H1><p><iframe src='about:blank' name ='foo'></iframe>"); Changed ID tag to name tag
$oFrame = _IEGetObjByName($oIE,"foo"); Does not work on iframe, changes entire page
_IEBodyWriteHTML($oFrame, "hi")
Edited by complexjunk

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

  • Similar Content

    • nassausky
      By nassausky
      Hi all,
       
      Anyone have any idea how to close all open tabs except a specific one I manually open.  Assuming I don't know what is open in all the tabs except just the one I want to keep open.
       
      I didn't want to use sendkeys and I was trying to use the following code to list the title (or url) of the 3 open tabs and  after I got that part working I would just close the other 2. This sample only displays the title of the first open tab
      #include <IE.au3> Const $ie_new_in_tab = 0x0800 $oIE = _IECreate("https://www.autoitscript.com") __IENavigate($oIE, "https://www.autoitscript.com/forum/", 1, $ie_new_in_tab) ;(obj,url,wait,param) __IENavigate($oIE, "https://www.google.com/", 1, $ie_new_in_tab) ;(obj,url,wait,param) Local $aIE[1] $aIE[0] = 0 Local $i = 1, $oIE While 1     $oIE = _IEAttach("", "instance", $i)     If @error = $_IEStatus_NoMatch Then ExitLoop     ConsoleWrite(_IEPropertyGet($oIE, "title") & @CRLF)     ReDim $aIE[$i + 1]     $aIE[$i] = $oIE ;each item holds object     $aIE[0] = $i ;first item holds count     $i += 1 WEnd MsgBox($MB_SYSTEMMODAL, "Browsers Found", "Number of browser instances in the array: " & $aIE[0]) ; This doesn't return the list of tabs in the console just the first tab  
      Thanks for any and all help
    • toto22
      By toto22
      I'm trying to click on Java Dropbox using IE. However, I'm running into problems. There is a Dropbox "Please Select" with two options "Buy" and "Sell".
      I'm able to click on a drop box (please see code below) but i'm unable to select "Buy" or "Sell"".
      Local $sMyString = "Please Select" ;############ ENTER ############# Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next  
      Please help
       
         
    • Gowrisankar
      By Gowrisankar
      Hello everyone,
      I'm working on a task where, a PDF file is opened (in IE browser) when I click a link in a website.
      I have to read the first page of the PDF to find particular strings. Can you please share some ideas?
    • Seminko
      By Seminko
      Hey,
      i would like to set a value into an INPUT field.
      Checked the _IEFormElementSetValue function but that does require _IEFormGetObjByName and this is where the problem comes in. The input field I want to write to is not a part of a form tag. It is part of a table.
      <input type="text" class="w2" id="nabidka_vozidel_formular_tach_od" name="nabidka_vozidel_formular_tach_od" onchange="GLOBAL.pocetInzerceNZ(&quot;nabidka_vozidel_formular&quot;,&quot;tach_od&quot;,&quot;&quot;);" autocomplete="off"> I tried this but that didn't work:
      $oDownloadSamples = _IEGetObjById($oIE, "nabidka_vozidel_formular_tach_od") _IEFormElementSetValue($oDownloadSamples, "123") If you want to try the site I'm working with is https://www.tipcars.cz/. There is a menu on the top left hand side and if you click the "vyhledat" button the input fields will show up.
      Thanks
    • Seminko
      By Seminko
      I am now able to populate the dropdown menus at https://www.tipcars.com/.
      The dropdowns are dynamic and do not have a Text value, only ids.
      Is there a way to get all the available options from a dropdown?
      $url = "https://www.tipcars.com/" $oIE = _IECreate($url) _IELoadWait($oIE) $oDownloadSamples = _IEGetObjById($oIE, "homepage_vyhl_frm_vozidlo") _IEFormElementOptionSelect($oDownloadSamples, "C") Above code, populates ID 'C' into the 'druh' dropdown, which results in selecting 'užitkové'. 
      Is there a way so I can grab all of the options from the dropdown menu? I could easily grab all the IDs but I am afraid they will change in the future so I would much rather match the text titles and assign the option IDs grabbed from site.
      This is what the options are according to Chrome:
      <select class="w1"id="homepage_vyhl_frm_vozidlo"name="homepage_vyhl_frm_vozidlo"onchange="try{NABIDKA_VOZIDEL_FORMULAR.naplnSelectZnacka('homepage_vyhl_frm');GLOBAL.pocetInzerceHZ('homepage_vyhl_frm','vozidlo');}catch(ex){odeslatJsChybu('formHOMEPAGE onChange 1: ' + ex.message, 'formHomePage onChange 1', -1);}"> <option value="A" style="color: black;">osobní a terénní (56 334)</option> <option value="C" style="color: black;">užitkové (4 333)</option> <option value="D" style="color: black;">nákladní (3 742)</option> <option value="E" style="color: black;">autobusy (56)</option> <option value="F" style="color: black;">obytné (373)</option> <option value="G" style="color: black;">přívěsy (1 179)</option> <option value="J" style="color: black;">motorky (780)</option> <option value="S" style="color: black;">pracovní stroje (605)</option> <option value="L" style="color: black;">ostatní (235)</option></select> Also, this cannot be grabbed by _INetGetSource.
      Thanks