the helper method below can be called by the test class to determine when the page is fully synchronized with the server and the next action can be performed.
public static void waitForPageToFinishRendering(WebDriver oDriver, int timeout) {
ExpectedCondition
public Boolean apply(WebDriver d) {
JavascriptExecutor js = (JavascriptExecutor) d;
Boolean isReady = (Boolean)js.executeScript("return AdfPage.PAGE.isSynchronizedWithServer()");
return isReady;
}
};
WebDriverWait w = new WebDriverWait(oDriver,
w.until(e);
}
Good article....
ReplyDeletehttp://www.evalleypoint.com/
Great tip, thanks very much! Works way better than the kludgy alternative methods, and seems to work well consistently.
ReplyDeleteYour welcome! glad it worked for you
ReplyDeleteWhere can i get ADF javascript?
ReplyDeleteI'm not sure what it is your asking but the
ReplyDeleteAPI docs can be found at http://docs.oracle.com/cd/E23549_01/apirefs.1111/e12046/index-all-I.html
We were new to selenium web driver.plz let me know the best article for beginners
ReplyDeleteThere are several on the project site. Start with "getting started"
Deletehttp://code.google.com/p/selenium/
Hi Don,
ReplyDeleteWhat should I do if were facing an exception while executing the javascript to check that partial rendering of the page.
You can wrap the statement in a try/catch and return something in the catch statement. Like..
ReplyDeletetry (return AdfPage.PAGE.isSynchronizedWithServer();}
catch(err){ return false;}
Or return a message and handle it differently as if you landed on a non ADF page this would loop forever since there would be no AdfPage object.
I have figured it out to one more low level,
ReplyDeleteWhen ever I tried to check this method IsSynchronizedwithServer when the ADF page is having a protected element like TaxFileNumber/Password , the exception occurs else case it is just returning false or true.
I have verified and the ADFpage object is defined for that page.
The exception stacktrace of javascript executer says _textFieldField is null.
How can we know what exactly isSyncronizedWithserver() method consists and looks for in a ADF page.more likely I wish to see the code.
Thanks in advance and also for an immediate response.I very glad that you were following our comments after this long time.
I'm no longer working on an ADF project so don't have time to investigate. You can always set a breakpoint in firebug or other javascript debugger and step through the isSyncronizedWithServer method but with the minimized function names and lack of documentation I haven't found that to be too helpful. If it gets that exception does it work if you re-call the method until it succeeds or does it continue to fail?
ReplyDelete