cancel
Showing results for 
Search instead for 
Did you mean: 

cannot enter data to a <textarea> control

SOLVED
Occasional Contributor

cannot enter data to a <textarea> control

I am writing tests for a web application. On one page, there is a <textarea></textarea> control. I tried to record the actions of typing data into the control, but the recorded test seems not able to record the text entered.

I tried to write script to enter data, it also failed. I tried two ways to do it, but both did not work.

Can anyone help to let me know how to work this out? Your help are appreciated!

 

The two options that I tried:

1)

txtObj.Click()
aqutils.Delay(50)
txtObj.SetText(inpVal)
aqutils.Delay(50)
txtObj.Keys("[Tab]")
aqutils.Delay(50)

 

2)

txtObj.Click()
aqutils.Delay(50)
txtObj.wText = inpVal
aqutils.Delay(50)
txtObj.Keys("[Tab]")
aqutils.Delay(50)

 

The pic is the <textarea> in inspection window. I believe this control is an ASP.net control.

 

5 REPLIES
Highlighted
Occasional Contributor

Re: cannot enter data to a <textarea> control

The following pic is the control in inspection window. I believe this control is an ASP.net control.

TextArea.PNGThe <textarea> control on the page.

Contributor

Re: cannot enter data to a <textarea> control

Are you able to manually enter the data in the field?  The field states it must be a number.  If you are manually able to enter the data, does your script follow exactly the same process of your manual test?  Sometimes on an error you have to clear a field prior to entering the correct data.

Occasional Contributor

Re: cannot enter data to a <textarea> control

I am able to type in letters and numbers

Occasional Contributor

Re: cannot enter data to a <textarea> control

I can type in characters and numbers. The following is the function that performs the setting text. When I stepinto  the code, I can see the right textArea object on the page is selected and jas the focus when txtObj.Click() is executed, but the next line txtObj.SetText(inpVal) does not set the data on the page.

 

'******************************************************************************************
'Function:EnterTextAreaValue
'Description:Function to enter text in any text area
'Input Parameters :txtObj - the textArea object, lblName-the textArea Lable, inpVal-the input value
'******************************************************************************************
Public Function EnterTextAreaValue(txtObj,lblName,inpVal)
EnterTextAreaValue=true
If (txtObj is nothing) Then
fnInsertResult "Object does not exists","Please recheck object properties of textarea, " &lblName ,"",gFail
End If
If Not (txtObj.Exists) Then
fnInsertResult "Object does not exists","Please recheck object properties of textarea, " &lblName ,"",gFail
End If
If Not (txtObj.Visible) Then
fnInsertResult "Object does not visible","Please recheck object properties of textarea, " &lblName ,"",gFail
End If
If Not (txtObj.Enabled) Then
fnInsertResult "Object does not enabled","Please recheck object properties of textarea, " &lblName ,"",gFail
End If
On Error Resume Next
txtObj.Click()
aqutils.Delay(50)
txtObj.SetText(inpVal)
aqutils.Delay(50)
txtObj.Keys("[Tab]")
aqutils.Delay(50)
getPage().wait()
If Err.Number <> 0 Then
Log.Error gException & "EnterTextAreaValue"& Err.Description
EnterTextAreaValue = False
end if
On Error GoTo 0
End Function

Community Hero

Re: cannot enter data to a <textarea> control

What happens if you try

 

txtObj.Keys(inpVal)

 

 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.


I’ll be talking about “Hidden Treasures – TestComplete Script Extensions” at #SBConnect in October! Who’s joining me? Click here for tickets
Extensions available
Share Your Stories
Read Latest News
Top Kudoed Authors