내가 WatiN로 된 div의 매우 큰 목록을 반복하고있어 (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()
다음의 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
{
감사 크리스
이 코드가 포함 된 전체 메서드를 지나서보십시오 .. 그래서 도대체 무슨 일이 일어 났는지 이해할 수 있습니다 .. 예를 들어 d.Click()과 같은 코드 숨김이 발생합니다. 코드 로직 – MethodMan