Sendkeys causing UFT to interact incorrectly with subsequent edit field

  • Questions
  • Sendkeys causing UFT to interact incorrectly with subsequent edit field
Question ID: 107331
0
0

I have a WebEdit that can only be interacted with via the Sendkeys method. My problem is that UFT is not interacting correctly with the subsequent field. I have to enter data in a second WebEdit field, but UFT is only entering a few of the characters.

I cannot use a hard-coded "Wait" statement, so I’ve tried looping while object.readystate <> "complete" but that does not work. Any ideas on what I can do to ensure UFT is able to properly interact with another field after a Sendkeys command?

Marked as spam
Posted by (Questions: 10, Answers: 5)
Asked on January 10, 2017 2:33 pm
17 views
Answers (4)
0
Private answer

Have you tried using a .Click statement on the field?

You could also try recording in low-level mode and click on the field and then stop recording. Then do the SendKeys code after that statement.

What you are trying to do is bring the field into focus to accept the SendKeys input.

Marked as spam
Posted by (Questions: 2, Answers: 425)
Answered on January 10, 2017 2:53 pm
Thanks KaptainKayoss - that worked!
( at January 10, 2017 3:03 pm)
0
Private answer

Is the application setting focus on another field? You could also try using SendKeys ''{TAB}'' or use the arrow keys SendKeys ''{LEFT}'', SendKeys ''{RIGHT}'', etc. to navigate to the field and see if that also works if the other methods above don't.

Marked as spam
Posted by (Questions: 175, Answers: 22)
Answered on January 10, 2017 2:55 pm
0
Private answer

Some web object has javascript running on each key press which can be a problem with object like webedit. WebEdit just paste the whole string in at once where the javascript can not scan ecach character. I always recommend using Mercury.DeviceReplay over send keys because it is more reliable and has more functionally.

'Set the focus to the WebEdit then run this code.
Set DeviceReplay = CreateObject(''Mercury.DeviceReplay'')
myString=''Hello, World''
for strPosition=0 to Len(myString)-1
DeviceReplay.SendString( Mid (myString, strPosition, 1 ))
wait .100
next

Set DeviceReplay = Nothing

See the following:

*EOT documents*

[http://eyeontesting.com/answers/1947/view.html](http://eyeontesting.com/answers/1947/view.html)

*HPE documents *

[How to use the Device Replay feature?](https://softwaresupport.hpe.com/group/softwaresupport/search-result/-/facetsearch/document/KM184330) ID :[KM184330](https://softwaresupport.hpe.com/group/softwaresupport/search-result/-/facetsearch/document/KM184330)

HPE document [What are the DeviceReplay.PressKey key Codes](https://softwaresupport.hpe.com/group/softwaresupport/search-result/-/facetsearch/document/KM1194127) ID : [KM1194127](https://softwaresupport.hpe.com/group/softwaresupport/search-result/-/facetsearch/document/KM1194127)

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on January 10, 2017 3:12 pm
0
Private answer

As a follow-up, I have another field that I have to use Sendkeys with but it's sending too fast, so I'm trying to slow down the data entry. This is my code:
Set WshShell = CreateObject(''WScript.Shell'')
Browser(''ATLIS'').Page(''Roles & Permissions'').WebEdit(''Search Box'').Click
For i = 1 To Len(DataTable.Value(''User''))
WshShell.SendKeys Mid(DataTable.Value(''User''), i, 1)
WScript.Sleep 100
Next
Set WshShell = Nothing
But I keep getting an ''Object Required'' error on the ''WScript.Sleep'' line. Can someone please tell me what I'm doing wrong? Thx!!!

Marked as spam
Posted by (Questions: 10, Answers: 5)
Answered on January 10, 2017 4:20 pm