This is a migrated thread and some comments may be shown as answers.
Could not get the Radwindow height and width
1 Answer 25 Views
This is a migrated thread and some comments may be shown as answers.
Mahendra Kumar
Top achievements
Rank 1
Mahendra Kumar asked on 20 Sep 2011, 10:18 PM
Hi ,

I have a rad window in my application and I am trying to get the height and width of the rad window.
When I try to get the the rad window with below mentioned code it throws be a exception.
return m_radWindow.Width;
return m_radWindow.Height;
However, I am able to re-size the rad window, but not able to get the width/height.
Exception detail:
*************************************************************************************************************************************************************************
ArtOfTest.WebAii.Exceptions.ExecuteCommandException was unhandled by user code
  Message=ExecuteCommand failed!
InError set by the client. Client Error:
System.InvalidOperationException: Javascript call [$find(\'FilingCabinet\').getBounds($find(\'{0}\').get_popupElement()).height] failed! Please make the function exists and the call is using the correct prototype signature. Javascript error: [object Error]
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunction',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'$find(\'FilingCabinet\').getBounds($find(\'{0}\').get_popupElement()).height',ClientId:'Client_0096c116-6d01-455b-a291-5c81e1eb1606',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.InvalidOperationException: Javascript call [$find(\'FilingCabinet\').getBounds($find(\'{0}\').get_popupElement()).height] failed! Please make the function exists and the call is using the correct prototype signature. Javascript error: [object Error]
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.

  Source=ArtOfTest.WebAii
  StackTrace:
       at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
       at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
       at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
       at ArtOfTest.WebAii.Core.Actions.InvokeScript(String script)
       at ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions.InvokeScript(String script)
       at ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.GetValue[T](String propertyName, T defaultValue)
       at ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.GetValue[T](String propertyName)
       at ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.CallMethod[T](String methodCall)
       at Telerik.WebAii.Controls.Html.RadWindow.get_Height()
       at HCS.TMS.QA.Automation.PerformanceManager.UI.Controls.Common.PFMRadWindow.get_RadWindowHeight() in D:\HCS\WebAii Automation\PerformanceManager\Common\UI\Controls\Common\PFMRadWindow.cs:line 73
       at HCS.TMS.QA.Automation.PerformanceManager.Tests.Areas.Sandbox.MahendraSandBox.Test() in D:\HCS\WebAii Automation\PerformanceManager\Tests\Areas\zSandbox\MahendraSandBox.cs:line 98
  InnerException:
*************************************************************************************************************************************************************************
Please let me know if some one have come across the same.
Thanks in advance.

Regards,
Mahendra

1 Answer, 1 is accepted

Sort by
0
Misho
Telerik team
answered on 21 Sep 2011, 11:03 AM
Hello Mahendra Kumar,

    In order to get the RadWindow width or height you need first to get a reference to the RadWindow control by id. The second step is to use the relevant width/height properties of the RadWindow as you have specified. I’m sending you a sample test executed against our online examples. I’ve included also another option for obtaining with/height invoking a straight javaScript on the page.
[TestMethod]
public void WindowWidth()
{
    Manager.LaunchNewBrowser();
    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);
    //Secon Option
    string windowWidth = this.ActiveBrowser.Actions.InvokeScript(String.Format("$telerik.getBounds($find('RadWindow_ContentTemplate').get_popupElement()).width"));
    Assert.AreEqual("300", windowWidth);
}

I hope this helps.
Best Regards,
Misho
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Mahendra Kumar
Top achievements
Rank 1
Answers by
Misho
Telerik team
Share this question
or