Micro Focus QTP (UFT) Forums
SendKeys changing focus to IE url when executed from framework - 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: SendKeys changing focus to IE url when executed from framework (/Thread-SendKeys-changing-focus-to-IE-url-when-executed-from-framework)



SendKeys changing focus to IE url when executed from framework - psova - 06-09-2015

Hi All,

I am trying to automate a short scenario where a value is inserted to the WebEdit and submited via SendKeys "{ENTER}", see code bellow:

Code:
Dim oShell
Set oShell = CreateObject("WScript.Shell")

Browser().Page().WebEdit().Set("My text")
Browser().Page().WebEdit().Click
oShell.SendKeys "{ENTER}"

Set oShell = Nothing

Issue description:
Everything is working as expected when i am running the script from UFT tool as a single script, but as soon as I am using a framework build on AOM to execute this script at the end of a scenario (couple scripts are executed before this one), SendKeys method is focused on the IE URL instead of WebEdit...

I have tried following things:

1)
Code:
Browser().Page().WebEdit().Submit
-> submit instead of pushing enter key is not working on my WebEdit

2)
Code:
Browser().Page().WebEdit().Object.focus
-> not working as Sendkeys is again executed on the URL

3)
Code:
Wait(3)
-> waiting did not help at all, it is clear that right before SendKeys execution focus is changed to the IE URL

Framework description:
It might look like the framework is changing the focus somehow to the IE URL but i doubt it because the execution of the script in framework is represented in one line:
Code:
objTest.Run objResult

where objResult represent path to the result folder. Also when this line is executed (script is executed) framework is not doing anything.

If possible please can someone point me to the right direction how to figure this out?
Thank you for your time and effort!