Scrape on Ajax - Wait until element exist

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

veeco

Client
Регистрация
27.05.2011
Сообщения
112
Реакции
1
Баллы
18
Hello,
i would like to know if it possible to scrape ajax content with projectMaker. The idea is to wait until element exist, then begin scraping.

Thanks
 
There's ready snippet in link above.

If you wanna use php you can do it only in CodeCreator.
 
Will this code loop itself until it finds the element? What if the page return as server code 5xx error, what happens then?
 
Yes that one. But what if the server return an 502 error and it didn't find the element, how can I know. Am I missing something on that thread?
 
Im using btw:

Код:
Развернуть Свернуть Копировать
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);
}
 
this code doesnt have in-built logic and it will be succesful in 100% of cases. you need to throw error if element is not found?
 
Код:
Развернуть Свернуть Копировать
HtmlElement he;
bool found = false;
for(int i=0;i<20;i++)
{
    he = instance.ActiveTab.FindElementByAttribute("Your data in parameters");
    if(!he.IsVoid)
    {
        found = true; break;
    }
    System.Threading.Thread.Sleep(2000);
}
if (!found) throw new Exception("not found");
 
You are the best. Thanks, it works great.
 

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