Wednesday, January 19, 2011

Try and Catch method for page to load

for (int second = 0; second < 60; second++) {
            try {

                if (selenium.isElementPresent("//input[@value='Search']"));
                  selenium.click("//input[@value='Search']");
                Condition = true;
                selenium.waitForPageToLoad("20000");
                break;

            } catch (Exception ignore) {
            }
            pause(1000);
        }
        assertTrue(Condition);


Sometimes we get Timed error on waitForPageToLoad command

To over come this error we can ues Try and Catch method .

No comments:

Post a Comment