я итерация очень большой список дивы с WatiN (около 3000), и я получаю сообщение об ошибке:Как исправить WatiN OutOfMemoryException
A first chance exception of type 'System.OutOfMemoryException' occurred in WatiN.Core.dll
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at WatiN.Core.UtilityClasses.UtilityClass.TryFuncFailOver[T](DoFunc`1 func, Int32 numberOfRetries, Int32 sleepTime)
at WatiN.Core.Native.InternetExplorer.IEElement.GetWithFailOver[T](DoFunc`1 func)
at WatiN.Core.Native.InternetExplorer.IEElement.GetAttributeValue(String attributeName)
at WatiN.Core.Element.GetAttributeValueImpl(String attributeName)
at WatiN.Core.Component.GetAttributeValue(String attributeName)
at WatiN.Core.Element.get_OuterHtml()
at WatiN.Core.Document.get_Html()
При щелчке DIV затем получить HTML-код из браузер.
Кто-нибудь знает, как исправить проблему с памятью? Я надеюсь, что смогу использовать другую функцию или как-нибудь разбить страницу. Может быть, мне нужно будет использовать что-то другое, чем WatiN
Код:
foreach (Div d in browser.Divs)
{
try
{
d.Click(); // click div
System.Threading.Thread.Sleep(250); //wait for new data to load
string url = "";
if (browser.Html.Contains("http://www.google.com/url?")) // check if an external link exists on the page - this causes the memory exception
{
Спасибо за любую помощь
Chris
Просьба заполнить полный метод, который содержит этот код .. так что вы можете понять, что, черт возьми, вы даже пытаетесь сделать .. например, d.Click(), какой код происходит там .. это выглядит довольно грязно в терминах логики кода – MethodMan