- fireghost
- Posts : 3
Join date : 2012-01-20
Reload web page after timeout
Fri Jan 20, 2012 1:29 am
How can i reload the page after it is timeout?
Now, if the url timeout, testing stop, how could I modify the following code to let it reload again?
$this->open($url);
$this->waitForPageToLoad($pagetimeout);
i try to use
try {
$this->open($url);
$this->waitForPageToLoad($pagetimeout);
} catch (Exception $e) {
}
but i am fail too
Anyone can help? Thanks!!
Now, if the url timeout, testing stop, how could I modify the following code to let it reload again?
$this->open($url);
$this->waitForPageToLoad($pagetimeout);
i try to use
try {
$this->open($url);
$this->waitForPageToLoad($pagetimeout);
} catch (Exception $e) {
}
but i am fail too
Anyone can help? Thanks!!
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Reload web page after timeout
Fri Jan 20, 2012 3:05 pm
I didn't do it before, so I don't know if it is the best solution and if it works, but try this:
Please let me know if it is OK.
- Code:
$time = $pagetimeout / 1000;
for ($second = 0; ; $second++) {
if ($second >= $time) {
$this->refresh(); //simulation of clicking the "Refresh" button
//or open the url once again
//$this->open($url);
}
try {
if ($this->isTextPresent("some text which is presented at the page you are trying to open")) {
break;
}
} catch (Exception $e) {}
sleep(1);
}
Please let me know if it is OK.
- fireghost
- Posts : 3
Join date : 2012-01-20
Re: Reload web page after timeout
Fri Jan 20, 2012 3:51 pm
thanks!!
I will try it tonight and report the result here!
thanks again first!
I will try it tonight and report the result here!
thanks again first!
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Reload web page after timeout
Fri Jan 20, 2012 4:15 pm
OK, so we will continue resolving this issue on Monday (if this one isn't good solution)
- fireghost
- Posts : 3
Join date : 2012-01-20
Re: Reload web page after timeout
Wed Jan 25, 2012 1:18 am
i just try it but it fail
after I search around, i think it is the limitation of Selenium
As the "open" function is already include "wait" condition, if fail, trigger timeout.
seems no other method to stop the trigger.
for example, if i want to open 10 url and record down the loading time,
if any one of the url fail to load and trigger timeout, the rest of the url can't be record.
i just thinking how can i stop the trigger and continue the rest of the url.
it is trouble~~
after I search around, i think it is the limitation of Selenium
As the "open" function is already include "wait" condition, if fail, trigger timeout.
seems no other method to stop the trigger.
for example, if i want to open 10 url and record down the loading time,
if any one of the url fail to load and trigger timeout, the rest of the url can't be record.
i just thinking how can i stop the trigger and continue the rest of the url.
it is trouble~~
Permissions in this forum:
You cannot reply to topics in this forum