Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
fireghost
Posts : 3
Join date : 2012-01-20

Reload web page after timeout Empty 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!!
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Reload web page after timeout Empty 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:

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.
avatar
fireghost
Posts : 3
Join date : 2012-01-20

Reload web page after timeout Empty 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!
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Reload web page after timeout Empty 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) Smile
avatar
fireghost
Posts : 3
Join date : 2012-01-20

Reload web page after timeout Empty 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~~
Sponsored content

Reload web page after timeout Empty Re: Reload web page after timeout

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