Highlighted
Valued Contributor.
Valued Contributor.
602 views

Set text on a controlled field

Hello everybody !

 

UFT version : 12.54, Firefox version : 37.0.1, Chrome version : 67, IE version : 11.0.9

I have an input field where I have to enter a date (format dd/mm/yyyy). When I do it manually, everything is fine. With UFT, on IE, it works with a classic "Set". On Firefox and Chrome, after leaving the field, I have the error message "The date must have the format dd/mm/yyyy" (thank you, App, that's exactly what I gave you !). I have the same problem with an email field (where the app controls the presence of "@" and ".", I guess). It's like my input on Chrome and Firefox doesn't trigger the control.

I tried :

- Set

 

Browser("bla").Page("Bla").WebEdit("Bla").Set "10/12/2018"

- Type

 

 

Browser("bla").Page("Bla").WebEdit("Bla").Type "10/12/2018"

- SendKeys

 

 

Dim mySendKeys
set mySendKeys = CreateObject("WScript.shell")
Browser("bla").Page("Bla").WebEdit("Bla").Click mySendKeys.SendKeys("10/12/2018")
set mySendKeys = nothing

 

- DeviceReplay

Dim myDeviceReplay
Browser("bla").Page("Bla").WebEdit("Bla").Click

Set myDeviceReplay = CreateObject("Mercury.DeviceReplay") myDeviceReplay.SendString "10/12/2018"
set myDeviceReplay = nothing

- And a customized SetDate

 

obj.Click
obj.Set(val)
Wait 0,500
MouseReplay True
obj.Click -5, 5 'click outside of the field
MouseReplay False

Visually I always get what I want (except with "type" that does nothing at all for me), the field if filled with "10/12/2018", but I have the error message.

 

When I delete manually the last number (initially written with UFT), re-write it manually and leave the field manually, it works. On Chrome if I press "TAB" or "ENTER" (manually) it doesn't leave the field, I have to click outside of the field.

 

I'm running out of ideas. There may be something to try with the FireEvent but I don't understand how it works.

If you have any idea, I would be happy to try it ! 🙂

 

0 Likes
1 Reply
Highlighted
Respected Contributor.
Respected Contributor.

Re: Set text on a controlled field

Hello,

Hope that you are okay,

I was reviewing the topic that you open with us, and i understood the following:

I saw the approaches that you were trying to do, And for this case it seems that for this kind of scenario, it is something that can provide some workaround for this issue, also i saw that with some actions you are able to perform the actions but you are receiving the error "The date must have the format dd/mm/yyyy", if it is indeed performing the action, try with this code line before the steps that brings the issue:

  • on error resume next  ' this indicate that if error occured, UFT don't pause execution and report an error

then put the code that do the action

after that code enter, to return to the normal state of UFT

  • on error goto 0 ' this will recover the error setting

That is in case that UFT with code that you have is performing the action. and only receiving the error message.

If not what i can think in the top of my head is to use the workarounds for non supported scenarios(not saiying that it is, but it might help)

UI automation: please review these links to know more about UI automation

Insight recording, low level recording, analog recording

https://admhelp.microfocus.com/uft/en/14.03/UFT_Help/Content/User_Guide/Record_Test.htm

Also i saw in other forums, some similar topics maybe you will find something useful in these links:

If i am mistaken with something feel free to correct me 😄

Hope that this helps you in some way!

Regards,

Francisco

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.