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

Invalid input type Error

5 Answers 165 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Raj
Top achievements
Rank 1
Raj asked on 19 Nov 2014, 06:20 AM
Hi,

I'm getting error saying "Invalid input type 'Text' for this control. Control was expecting 'Number' ", when i convert the recorded step to code and pass value from the data table(excel).

Steps
1) Record the step and playback (works fine)
2) Record the step and convert the step to code (worksfine)
3) Record the step and Data bind to external excel (worksfine)
4) Convert the step to code which is data bound (error is thrown)

I have attached the screen shots of

1) Control properties
2) Code

Error message:

Failure Information:
~~~~~~~~~~~~~~~
Exception thrown executing coded step: '[Lodge_Monthly_Status_for_MINING_1_CodedStep] : Enter text '566' in 'AvgNumEmployeesText''.
InnerException:
System.ArgumentException: Invalid input type 'Text' for this control. Control was expecting 'Number'
   at ArtOfTest.WebAii.Controls.Control.CreateInstance[TControl](Element e, Boolean throwIfNull)
   at ArtOfTest.WebAii.ObjectModel.Element.As[TControl]()
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](HtmlFindExpression expr)
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](String[] clauses)
   at Pages.SafetyRegulationSystem5Page.get_AvgNumEmployeesText() in C:\Telrik\MSNew\Monthly Status (External)\Pages.g.vb:line 914
   at Monthly_Status__External_.Lodge_Monthly_Status_for_MINING__1_.Lodge_Monthly_Status_for_MINING_1_CodedStep() in C:\Telrik\MSNew\Monthly Status (External)\Mining\Lodge Monthly Status for MINING (1).tstest.vb:line 293


Please let me know how to resolve this issue.


Thanks
Raj

5 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 21 Nov 2014, 10:24 PM
Hello Raj,

This problem is not with the code or with the CType in the code. It's trying to tell you that when Test Studio ran it expected to find an element in the browsers DOM like this:

<input type="number">

But what it found instead was this:

<input type="text">

Because the target element is the wrong type it's throwing the error and aborting the test. We need to figure out why Test Studio is finding the wrong element. Is it possible the element is not in input mode? Is it possible the application change such that it used to be type number and now it's type text?


Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Matthew
Top achievements
Rank 1
answered on 14 Sep 2016, 05:23 PM

Was there any ever resolution to this?  I'm seeing a very similar error with similar steps.  In my case it is text input.  It works fine for a recorded step with data, but as soon as I convert to a coded step I see the error below.

Note -> this works fine on elements with input tags, but we should be able to input text into elements with textarea tags as well.  

 

Failure Information: 

~~~~~~~~~~~~~~~
Exception thrown executing coded step: 'Enter text 'UserID' in 'UserIdText''.
InnerException:
System.ArgumentException: Invalid tag name 'textarea' for this control. Control was expecting 'input'
   at ArtOfTest.WebAii.Controls.Control.CreateInstance[TControl](Element e, Boolean throwIfNull)
   at ArtOfTest.WebAii.ObjectModel.Element.As[TControl]()
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](HtmlFindExpression expr)
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](String[] clauses)
   at AaaS.Pages.Add_UserPage.get_UserIdField() in c:\Users\MD-CS-win7\workspace\acs_web\ACS\Pages.g.cs:line 1098
   at AaaS.Add_user_with_all_required_and_optional_fields.SetUniqueUserID_CodedStep() in c:\Users\MD-CS-win7\workspace\acs_web\ACS\User Onboarding\AaaS-24.tstest.cs:line 61

0
Boyan Boev
Telerik team
answered on 19 Sep 2016, 08:07 AM
Hi Matt,

This is a duplicate post of your ticket 1062456. Please provide us with the additional information in the ticket so we can try reproducing the issue and give you a solution.

Thank you!

Regards,
Boyan Boev
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Ernst
Top achievements
Rank 1
answered on 03 Nov 2017, 02:44 PM
Hi,

I guess I have run into the same kind of issue of a coded step not working while the recorded does.

Part of my webpage:

<div id="subnav">

                <div class="pad">
                    <ul class="breadcrumb" id="breadcrumb">
<li><a href="https://<classified>/site/index">Startpagina</a></li>
<li><a href="/site/sitemap/sub/13">Beheer</a></li>
<li class="active"><a href="<classified2>">Autorisatie</a></li>
</ul>                    <div id="toolbar">
                        <ul id="inline">

What I wanted is a Waitfor on an element I created which is found by "id is exactly breadcrumb" that contains InnerMarkup "<classified2>" or even better InnerText contains Autorisatie

So in a "clicked together step", this goes wel.

Wait for 'InnerMarkup' 'Contains' 'https://<classified2>' on 'BreadCrum'

But when I convert this to a coded step and run it:

Coded step:

[CodedStep(@"Wait for 'InnerMarkup' 'Contains' 'http://<;classified2>' on 'BreadCrum'")]<br>        public void DMS_auto_loop_v3_CodedStep3()<br>        {<br>            // Wait for 'InnerMarkup' 'Contains' 'http://<;classified2>' on 'BreadCrum'<br>            Pages.<page>.BreadCrum.BaseElement.Wait.ForCondition((a_0, a_1) => ArtOfTest.Common.CompareUtils.StringCompare(a_0.InnerMarkup, "http://<;classified2>", ArtOfTest.Common.StringCompareType.Contains), false, null, 30000);<br><br>    }<br>

ArtOfTest.Common.Design.Exceptions.ExecutionException: Exception thrown executing coded step: 'Wait for 'InnerMarkup' 'Contains' 'http://<classified2>' on 'BreadCrum''. ---> System.ArgumentException: Invalid tag name 'ul' for this control. Control was expecting 'a'

I need a coded step for my test, so how can I resolve the error?

Regards,
Ernst
0
Elena
Telerik team
answered on 07 Nov 2017, 09:09 AM
Hi Ernst,

Thank you for posting to the forum. Though this post duplicates a support ticket of yours and will be closed. Please refer to it.

Thank you for your understanding in advance! 

Regards,
Elena Tsvetkova
Progress Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Raj
Top achievements
Rank 1
Answers by
Cody
Telerik team
Matthew
Top achievements
Rank 1
Boyan Boev
Telerik team
Ernst
Top achievements
Rank 1
Elena
Telerik team
Share this question
or