How to refresh browser in coded ui test
My application is up and running in IE 9, but sometimes not everything loads correctly on the page and this is causing my coded ui test to fail. So I want to add some code to my coded ui test to refresh (F5) the browser when this happens. How can i do this?
When the web browser is launched, an instance of the object is returned BrowserWindow
. This object BrowserWindow
contains a method Rrefresh
that you can call:
BrowserWindow currentBrowser = BrowserWindow.Launch(new Uri("https://www.google.com/"));
currentBrowser.Refresh();
You can also call the method Locate
to get the instance BrowserWindow
you are using if you need to update elsewhere:
BrowserWindow currentBrowser = BrowserWindow.Locate("title of your browser window");
currentBrowser.Refresh();