It is very small action but if you are new with CodedUI and struggling to take off (Opening and Closing the browser) with CodedUI then this post could help you…

To start browser and your application you can use below line of code-

BrowserWindow browser = BrowserWindow.Launch(new System.Uri(“http://www.google.com”));

Above code will start you browser.

browser.close(); //it will close your browser.

If you have switched to new window and now if you wanted to close only that window then use below code sample-

BrowserWindow newwindow = new BrowserWindow();
newwindow.SearchProperties.Add(“Title”, “Google”);

Mouse.Click(newwindow);

Hope it will help…

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s