Answer the question
In order to leave comments, you need to log in
How to free memory after using IHTMLElement?
The TImbeddedWB component is used to process web pages.
A long list of pages opens (about 10,000).
Further, work with the DOM model of the document is carried out using variables of the IHTMLElementCollection and IHTMLElement types.
One of the code snippets:
tmpInputs := WB.GetDocument.all.tags('input') as IHTMLElementCollection;
for i := 0 to tmpInputs.Length - 1 do
begin
tmpElement := tmpInputs.item(i, 0) as IHTMLElement;
tmpS := tmpElement.getAttribute('name', 0);
if tmpS = 'searched_name' then
begin
tmpElement.setAttribute('value', 'somevalue', 0);
tmpFound := True;
break;
end;
end;
Answer the question
In order to leave comments, you need to log in
Why look for the field name through the collection, and even through the DOM?!
Can't you just parse pages using Source+Regex?
And already then - expose?
Don't use for on collections. Use while-do and free memory on each loop through the method of removing an object from the collection.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question