Webdriver has a method to refresh current page void refresh() but if page contains multiple IFrame's and we need to refresh IFrame only not whole page then use the under given method to refresh the IFrame through Java Script Executor-
///
/// Refresh the current selected iframe.
///
///
/// Refresh the current selected iframe.
///
/// This is name of the Iframe.
/// Executes
JavaScript in the context of the currently selected frame or window.
/// The script fragment provided will be executed as the body
of an anonymous function.
/// Indicates
that a driver can execute JavaScript, providing
/// access to the mechanism to do so.
protected
void RefreshIFrameByJavaScriptExecutor(string iFrameName)
{
((IJavaScriptExecutor)WebDriver).ExecuteScript(string.Format("document.getElementById('{0}').src =
" + "document.getElementById('{0}').src",
iFrameName));
}
Good post and it was so informative and helpful.i refer this blog to my friends.Thank you software testing training with job guarantee
ReplyDeleteselenium training in chennai