This project is read-only.

Identify browser window by absolutepath

Apr 18, 2013 at 11:48 AM
Edited Apr 18, 2013 at 12:12 PM
Hi All,

browser windows are identified by the following
ReviewPage reviewPage = CUITe_DynamicBrowserWindow.GetBrowserWindow<ReviewPage>("[project title] PleaseReview™");
is there a way to identify the browser window by part of the title or absolute path or any property other than title?

for example if the title is "public new string sWindowTitle = "coded ui test framework - Google Search" i only want to give part of it "Google Search" or part of its absolute path ""

is this possible?
Apr 22, 2013 at 1:47 AM
Hi deepakguna,

Browser window titles seem to support partial matches.

Here is an example:
            using (TempFile tempFile = new TempFile(
        <title>test 1 2 3</title>
        <button id=""buttonId"" >Button</button>
                CUITe_BrowserWindow window = new CUITe_BrowserWindow("test");

                CUITe_HtmlButton button = window.Get<CUITe_HtmlButton>("id=buttonId");

                Assert.AreEqual(button.InnerText, "Button");


The sample code also illustrates how to get the Uri of the browser window.

Does this satisfy your requirements?
If not, in what scenario is finding a specific browser instance that has navigated to a specific Uri required?
Apr 23, 2013 at 5:02 AM
Thank you icnocop!

there are some scenarios where we need to use absolute path or part of it to uniquely identify a window, (title will be same )
Apr 23, 2013 at 6:45 AM
I don't believe Coded UI supports this kind of functionality out-of-the-box, so you will have to implement it yourself.

Here is some sample code that enumerates all Internet Explorer browser windows and outputs the uri and title:
            Process[] processes = Process.GetProcessesByName("iexplore");
            foreach (Process process in processes)
                if (string.IsNullOrEmpty(process.MainWindowTitle))

                BrowserWindow bWin = CUITe_BrowserWindow.FromProcess(process);
                Trace.WriteLine(string.Format("Found browser window: {0} {1}", bWin.Uri, bWin.Title));
Apr 23, 2013 at 11:31 AM
Thank you again,

I think coded ui supports this absolutepath property out of the box. which you can use to identify the browsers/page document. I was looking for something like this in CUite, but on seeing browser window we just have title
Apr 24, 2013 at 8:35 AM
Related to my last post, you can use bWin.Uri.AbsolutePath for example.

The BrowserWindow class is part of Microsoft's Coded UI namespace (Microsoft.VisualStudio.TestTools.UITesting).