Stop loading page after a certain time

Stroks

Client
Регистрация
09.02.2012
Сообщения
219
Благодарностей
14
Баллы
18
I can put timeout setting in order to stop loading a page after certain time - lets say 60 sec.

But this doesn't always work, as when there are some strange proxy errors the page loads for a really long time - around 500 sec or more I think.

1) Is there any way to add a command that would stop page from loading. The command that is th same as clicking on the red X button in the project maker browser.

2) How is it possible to get the page text before the page is fully loaded (it loads longer because of the javascript execution).
This code doesn't work for exmaple, as it waits untill the page is loaded:
##############################
Tab tab = instance.ActiveTab;
if ((tab.IsVoid) || (tab.IsNull)) return -1;
//if (tab.IsBusy) tab.WaitDownloading();
tab.Navigate(project.Variables["myurl"].Value, "");
//if (tab.IsBusy) tab.WaitDownloading();
##############################

I disabled/commented out tab.WaitDownloading, but it still waits untill the page is loaded.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 412
Благодарностей
5 899
Баллы
113
1) I can advise you to play with loading settings in browser profile in such cases - http://zennolab.com/wiki/en:browser#loading-settings
There may be some script or request, which browser is waiting long for.
2) Environment variable {-Page.Text-} contains text of loaded page. You may get its value.
 

Stroks

Client
Регистрация
09.02.2012
Сообщения
219
Благодарностей
14
Баллы
18
2) I know I can get text using {-Page.Text-} variable.
But I need to get page text, for example 5 seconds after the page started loading (tab.Navigate(project.Variables["myurl"].Value, "");-) and then
depending on the text stop loading the tab.

Is there way to get at least http response of tab.Navigate(project.Variables["myurl"].Value, "") before the request is executed.

Because I use rotating proxies, so in quite a lot of cases (30% maybe) I get error response, and I have to detect them as soon as possible. But normal request takes around 20-30 sec, while request then there is proxy/connection error is 100-300 sec so it slows down the execution for 2-3 times.

Thanks
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 799
Благодарностей
1 187
Баллы
113
Hi.
This code You showed should not wait page loading in full, it just goes to url and finishes.
Please show url what does not work as expected.

C#:
Tab tab = instance.ActiveTab;
if ((tab.IsVoid) || (tab.IsNull)) return -1;
//if (tab.IsBusy) tab.WaitDownloading();
tab.Navigate(project.Variables["myurl"].Value, "");
//if (tab.IsBusy) tab.WaitDownloading();
To add any static pause You can use code:

C#:
Thread.Sleep(5000); // Pause 5 s
 

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