Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Reload web page after timeout

View previous topic View next topic Go down

Reload web page after timeout

Post by fireghost on 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!!

fireghost

Posts : 3
Join date : 2012-01-20

Back to top Go down

Re: Reload web page after timeout

Post by faramka on 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:

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.

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Reload web page after timeout

Post by fireghost on Fri Jan 20, 2012 3:51 pm

thanks!!
I will try it tonight and report the result here!
thanks again first!

fireghost

Posts : 3
Join date : 2012-01-20

Back to top Go down

Re: Reload web page after timeout

Post by faramka on Fri Jan 20, 2012 4:15 pm

OK, so we will continue resolving this issue on Monday (if this one isn't good solution) Smile

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Reload web page after timeout

Post by fireghost on 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~~

fireghost

Posts : 3
Join date : 2012-01-20

Back to top Go down

Re: Reload web page after timeout

Post by Sponsored content Today at 9:01 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum