Cannot cast HtmlControl to HtmlInputText

2 posts, 0 answers
  1. Al
    Al avatar
    14 posts
    Member since:
    Mar 2017

    Posted 12 May 2017 Link to this post

    Using the Find.ByAttributes<T>() method I am able to find a specific control in the DOM, but once found I cannot cast it to a more specific type, HtmlInputText. The control is an input field, which can be seen in the HtmlControl properties. I then attempt to cast the HtmlControl by simply:

    HtmlInputText _email = ctrl as HtmlInputText; (ctrl is the generic HtmlControl)

    I could work with the HtmlControl, but there are specific methods and properties that the HtmlInputControl has that the more generic HtmlControl does not.

    I was hoping to find any feedback on why the casting could not be done, when the HtmlControl returned was an input control.

  2. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    942 posts

    Posted 16 May 2017 Link to this post

    Hi Al,

    Thank you for the shared description. 

    Please use HtmlInputControl instead of HtmlInputText. This should be the control you are looking for. 

    Regards,
    Elena Tsvetkova
    Telerik by Progress
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top