Reputation: 81
My application is up and running in IE 9 but sometimes not everything loads properly on the page and it causes my coded ui test to fail. So I want to add code to my coded ui test to refresh (F5) the browser when this happens. How can I do this?
Upvotes: 3
Views: 2225
Reputation: 15401
When you launch the web browser it returns an instance of the BrowserWindow
object. That BrowserWindow
object contains a Rrefresh
method you can call:
BrowserWindow currentBrowser = BrowserWindow.Launch(new Uri("https://www.google.com/"));
currentBrowser.Refresh();
You can also call use the Locate
method to get an instance of the BrowserWindow
you are using if you need to do the refresh in a different place:
BrowserWindow currentBrowser = BrowserWindow.Locate("title of your browser window");
currentBrowser.Refresh();
Upvotes: 1