Extending CUITe_BrowserWindow

Jan 13, 2014 at 6:57 PM
Edited Jan 13, 2014 at 7:05 PM
Hi,
I am new to CUITe world. I have a 'Page' class which has a List<Control>. The Page class looks like this:
internal class Page : CUITe_BrowserWindow {

    public new string sWindowTitle = "page";
    //public Page(string pageId)
    //{
    //  this.id = pageId;
    //}

    public Page(string title) 
    : base(title) 
    { 
    } 

    public Page()
    : base("page")
    {
    }

    private string id;
    public string Id {
      get { return id; }
      set { id = value; }
    }

    private string searchProperties;
    public string SearchProperties {
      get { return searchProperties; }
      set { searchProperties = value; }
    }

    public List<Control> ControlCollection = new List<Control>();
  }
The Control class looks like :
internal class Control {
    private string id;
    public string Id
    {
      get { return id; }
      set { id = value; }
    }

    private string parentId;
    public string ParentId {
      get { return parentId; }
      set { parentId = value; }
    }

    private string controlType;
    public string ControlType
    {
      get { return controlType; }
      set { controlType = value; }
    }

    private string searchProperties;
    public string SearchProperties
    {
      get { return searchProperties; }
      set { searchProperties = value; }
    }

    public List<Control> ChildrenControl = new List<Control>();
  }
I wish to make this Page class a derived class from CUITe_BrowserWindow class. I tried setting sWindowTitle from the the constructor as well. But, still I am not able to cast it.

This should be an easy fix and of course, I am doing something stupid here. Can someone please help me with this?
Coordinator
Jan 14, 2014 at 7:55 AM
What is the complete error message you get?
Jan 14, 2014 at 3:48 PM
When I try to do this:
Page myPage = (Page) CUITe_BrowserWindow.Launch<CUITe_BrowserWindow>("http://www.google.com");
I get following InvalidCastException:
Unable to cast object of type 'CUITe.Controls.HtmlControls.CUITe_BrowserWindow' to type 'UIAutomationFramework.Utilities.Page'.
Coordinator
Jan 14, 2014 at 4:52 PM
Try this:
Page myPage = CUITe_BrowserWindow.Launch<Page>("http://www.google.com");
Marked as answer by Ksaxena on 1/14/2014 at 10:08 AM
Jan 14, 2014 at 5:08 PM
My bad!! That worked for me now. Thank you for your help. :)