Looping through document address

  • Автор темы Автор темы smk
  • Дата начала Дата начала

smk

Client
Регистрация
25.12.2011
Сообщения
9
Реакции
0
Баллы
0
I'm trying to loop through all the documents as the page is dynamic. This is for hotmail because the message goes to spam folder.
Код:
Развернуть Свернуть Копировать
DocumentCollection docCol = tb.AllDocuments;
he = null;
int counter = 0;
while((he.IsVoid || he.IsNull) && counter < docCol.Count){ 
	Document doc = docCol.GetByNumber(counter);
	he = doc.FindElementById("folderListControlUl").FindChildByAttribute("span", "OuterText", "Junk", "regex", 0);
	if(he.IsVoid){
		he = doc.FindElementById("folderListControlUl").FindChildByAttribute("a", "OuterText", "Junk", "regex", 0);
	}else if(he.IsVoid){
		he = doc.FindElementByTag("form", -1).FindChildByAttribute("a", "OuterText", "Junk", "regex", 0);
	}
	counter++;	
}
he.RiseEvent("click", true);
This gives me an error at Document doc = docCol.GetByNumber(counter);
Code exception: Object reference not set to an instance of an object

I've been trying to debug by myself but there doesn't seem to be an easy way to see what documents are on the page. Is there a way to represent the collection of documents in the tab in string format?

Thanks,
 
The fix

Create an array of Strings
Код:
Развернуть Свернуть Копировать
String[] allDocs = new String[] {"0", "0;0", "0;1".....}
Just remember a bunch that have occurred in the past

Then throw them into a loop
Код:
Развернуть Свернуть Копировать
for(int i = 0; i < allDocs.length; i++){
he = instance.GetTabByAddress("page").GetDocumentByAddress(allDocs[i]).FindElement.....
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)