I am writing a pdf grabber in C# using Watin. For some reason, my code runs ok when I breakpoint a line and then step through manually, but when I let it run, it does the same (first) step twice and stops. Then after some tome it gives me an error that IE is busy.
Here's my code
namespace grabber
{
class Program
{
[STAThread]
static void Main(string[] args)
{
IE preglednik = new IE("blabla.com");
preglednik.WaitForComplete();
SpanCollection straniceTipke = preglednik.Spans.Filter(Find.ByClass("stranice"));
Console.WriteLine();
int x = 1;
while (x < 46) {
preglednik.WaitForComplete();
DivCollection ukratko = preglednik.Divs.Filter(Find.ByClass("pregled0"));
foreach (Div dio in ukratko)
{
string imeprezime = dio.Elements[6].ToString();
string[] opisIgodine = dio.Elements[7].ToString().Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
string opis = opisIgodine[0];
string godine = opisIgodine[1];
//LINKOVI
dio.Elements[1].GetAttributeValue("onclick");
string link = dio.Elements[1].GetAttributeValue("onclick");
string[] linkovi = link.Split('\'');
string[] fajlovi = link.Split('/');
}
Console.WriteLine(x + " - KRAJ");
x++;
straniceTipke[x].Links[0].ClickNoWait();
}
}
}
}