Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara

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


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