This is a migrated thread and some comments may be shown as answers.

Cannot cast HtmlControl to HtmlInputText

1 Answer 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Al
Top achievements
Rank 1
Al asked on 12 May 2017, 03:50 PM

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.

1 Answer, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 16 May 2017, 12:10 PM
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
 
Tags
General Discussions
Asked by
Al
Top achievements
Rank 1
Answers by
Elena
Telerik team
Share this question
or