Getting RadWindow Width and Height

You need to get the RadWindow width or height property.

Solution

First you need to get a reference to the RadWindow control by ID. Once you get it there are two options for getting the width/height. The first option is to use the relevant width/height properties of the RadWindow. The second is by invoking a straight JavaScript on the page.

Here is the standard approach:

Manager.LaunchNewBrowser();
ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx");
Find.ById<HtmlInputSubmit>("Button3").MouseClick();
System.Threading.Thread.Sleep(1000);
ActiveBrowser.RefreshDomTree();
RadWindow window = Find.ById<RadWindow>("RadWindowWrapper_RadWindow_ContentTemplate");

//First Option
Assert.AreEqual(300, window.Width);
Manager.LaunchNewBrowser()
ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx")
Find.ById(Of HtmlInputSubmit)("Button3").MouseClick()
System.Threading.Thread.Sleep(1000)
ActiveBrowser.RefreshDomTree()
Dim window As RadWindow = Find.ById(Of RadWindow)("RadWindowWrapper_RadWindow_ContentTemplate")

Assert.AreEqual(300, window.Width)

Invoking JavaScript on the page:

Manager.LaunchNewBrowser();
ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx");
Find.ById<HtmlInputSubmit>("Button3").MouseClick();
System.Threading.Thread.Sleep(1000);
ActiveBrowser.RefreshDomTree();
RadWindow window = Find.ById<RadWindow>("RadWindowWrapper_RadWindow_ContentTemplate"); 

//Second Option
string windowWidth = this.ActiveBrowser.Actions.InvokeScript(String.Format("$telerik.getBounds($find('RadWindow_ContentTemplate').get_popupElement()).width"));
Assert.AreEqual("300", windowWidth);
Manager.LaunchNewBrowser()
ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx")
Find.ById(Of HtmlInputSubmit)("Button3").MouseClick()
System.Threading.Thread.Sleep(1000)
ActiveBrowser.RefreshDomTree()
Dim window As RadWindow = Find.ById(Of RadWindow)("RadWindowWrapper_RadWindow_ContentTemplate")

Dim windowWidth As String = Me.ActiveBrowser.Actions.InvokeScript([String].Format("$telerik.getBounds($find('RadWindow_ContentTemplate').get_popupElement()).width"))
Assert.AreEqual("300", windowWidth)