Modify

Opened 6 years ago

Closed 4 years ago

#2865 closed Bug (No Bug)

Autoit crash with NodeList on For In loop

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.3.12.0 Severity: None
Keywords: Cc:

Description

$document = ObjCreate("HTMLFILE")
$document.write('<input type="hidden" name="test"/>')
$inputs = $document.querySelectorAll("input")
For $item = 0 To $inputs.length -1
	ConsoleWrite($inputs.item($item).name & @CRLF)
Next

For To loop work fine, but For In leads to hard crash:

For $input In $inputs
	ConsoleWrite($input.name & @CRLF)
Next

And it looks like a fall occurs when the script exits

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by jchd18

All I get is that:

"C:\Users\...\tmp\d.au3" (17) : ==> The requested action with this object has failed.:
$inputs = $document.querySelectorAll("input")
$inputs = $document^ ERROR

comment:2 Changed 6 years ago by anonymous

Try this. You need ie version >9+

#include <ie.au3>
$oIe = _IECreate('http://www.autoitscript.com/forum/', 1)
$inputs = $oIe.document.querySelectorAll("input")
For $input In $inputs
	ConsoleWrite($input.name & @CRLF)
Next

but in this example autoit crash browser

comment:3 Changed 4 years ago by mLipok

  • Resolution set to No Bug
  • Status changed from new to closed

This is related to IE object.

This was discussed and solved here:
https://www.autoitscript.com/forum/topic/181376-_iequeryselectorall/?do=findComment&comment=1303644

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.