CodeCreator - C# : Wait for x seconds?

PapyRef

Client
Регистрация
28.02.2012
Сообщения
70
Благодарностей
6
Баллы
0
In some HTML pages, it sometimes happen that the function IsBusy() is KO even though the page is not entirely loaded.

For example :
Код:
he.RiseEvent("click", instance.EmulationLevel);
if (tab.IsBusy) tab.WaitDownloading();
he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("a", "InnerText", "Log\\ out", "regexp", 0);

// Test KO because HTML page is not entirely loaded.
if (he.IsVoid) {
                .......
}
One solution I've found is to use the Thread.Sleep () function
Код:
....
if (tab.IsBusy) tab.WaitDownloading();
System.Threading.Thread.Sleep(5000);
....
but it does not seem like the best solution.

Others ideas ?
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
831
Баллы
113
I do something like wait for element
JavaScript:
HtmlElement he;
for(int i=0;i<20;i++)
{
	he = instance.ActiveTab.FindElementByAttribute("Your data in parameters");
	if(!he.IsVoid)
	{
		break;
	}
	System.Threading.Thread.Sleep(2000);
}
 
  • Спасибо
Реакции: ruthless

PapyRef

Client
Регистрация
28.02.2012
Сообщения
70
Благодарностей
6
Баллы
0
Thank's :az:
 

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