Micro Focus QTP (UFT) Forums
Can not get text to be recognized in HTML field........ - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Can not get text to be recognized in HTML field........ (/Thread-Can-not-get-text-to-be-recognized-in-HTML-field)



Can not get text to be recognized in HTML field........ - Wonka - 08-03-2010

I am trying to enter some text into an HTML field in my application.

Using the following Set command (code below) inserts the text "TEST", but the HTML field does not recognize the text. The text gets set but it acts like a copy and paste. The field allows 254 characters and when "TEST" is set the field thinks there is no characters in it.

Code example:
Code:
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set ("Test")


So I decided to try to use SendKeys but I cant seem to get it to work with my application. I cant seem to get 12345 displayed into the application??

Code example:

Code:
Set WshShell = CreateObject("Wscript.Shell")

Browser("Browser").Page("General Information").PSFrame("Contract Header").WebEdit("txtAssign").Click

WshShell.SendKeys "12345"



Any ideas on why SendKeys does not work for me? or if anyone has another way I can SET the text in the HTML field? The field will allow 254 characters but when I do the SET in QTP the HTML field still thinks there is 254 available characters in the field so a message box appears stating "No text has been entered".


The application I am using is PeopleSoft 9.0


RE: Can not get text to be recognized in HTML field........ - Wonka - 08-04-2010

I resolved the issue for some reason I had to use descriptive programing on the object in order for send keys to work. Used the following code

Code:
Set WshShell = CreateObject("WScript.Shell")

Browser("title:=General Information").Page("title:=General Information").PSFrame("title:=Contract Header").WebEdit("name:=ASSIGN").Click

WshShell.SendKeys("E")

Set WshShell = Nothing



RE: Can not get text to be recognized in HTML field........ - Ankur - 08-05-2010

Can you try this and let us know -

Code:
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Click
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set "Test"
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Click

Also please use proper code formatting while asking /responding to queries.


RE: Can not get text to be recognized in HTML field........ - Wonka - 08-05-2010

Ankur,

The above code does not work.
The Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set "Test"
does put the word TEST in the field, but the HTML field does not recognize it. The field has a max of 254 char's once I do the
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set "Test"
the field char counter does not go down to 250 char like expected the counter is still at 254 char.


RE: Can not get text to be recognized in HTML field........ - venkatbatchu - 08-06-2010

Hi,
Put Index:=0 as the additional property for WebEdit class , you may not face this issue.

Venkat.Batchu


RE: Can not get text to be recognized in HTML field........ - Ankur - 08-06-2010

Just checking. Have you tried this or is it just your assumption? Also try it by putting Wait statements before and after Set statement.

(08-05-2010, 07:33 PM)Wonka Wrote:
(08-05-2010, 01:47 PM)Ankur Wrote: Can you try this and let us know -

Code:
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Click
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set "Test"
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Click

Also please use proper code formatting while asking /responding to queries.

Ankur,

The above code does not work.
The Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set "Test"
does put the word TEST in the field, but the HTML field does not recognize it. The field has a max of 254 char's once I do the
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set "Test"
the field char counter does not go down to 250 char like expected the counter is still at 254 char.



RE: Can not get text to be recognized in HTML field........ - basanth27 - 08-13-2010

Ankur,
my 2 cents around, i guess clicking on the frame after the set may help rather than click on the webedit itself.


RE: Can not get text to be recognized in HTML field........ - Wonka - 08-13-2010

I did true this solution and it did not work:
Code:
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Click
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set "Test"
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Click

The following with the WAIT statements worked:

Code:
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Click
Wait(2)
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Set "Test"
Wait(2)
Browser("Browser").Page("GeneralInformation").PSFrame("ContractHeader").WebEdit("txtAssign").Click

Thanks for all the helpful posts.