Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Java Popup Focus Lost
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
My application is java swing and uses JidePopups containing java menus which QTP recognises as JavaMenu objects.

In order to close a tab in the application I right click on it and have to select the "Close" JavaMenu item from the popup. My code is as follows:

Code:
JavaWindow("ldnGUI").JavaTab("TdiGroup").Click 10,10,"RIGHT"
JavaWindow("ldnGUI").JavaMenu("label:=Close").Select

However, it seems that following the execution of the right click command, focus is lost from the popup when QTP goes to the next code line, and because focus is lost the popup disappears. When QTP comes to execute the selection of the Close menu item, it is no longer there and the action doesn't take place.

Has anyone come across this before with java popups or more specifically, JidePopups?

Strangely, when I record these actions and play them back it works fine, but I can't use the recorded versions due to the way my scripts have to be set up.

Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Please try the below code
Code:
Setting.WebPackage("ReplayType") = 2 ' This lines changes the run mode as Analog
JavaWindow("ldnGUI").JavaTab("TdiGroup").FireEvent "onclick",10,10,micRightBtn
wait(2)
Set WshShell = CreateObject("WScript.Shell")
itemIndex=5<Please change this>  'index of the close item

For i = 1 To itemIndex
WshShell.sendkeys "{DOWN}" 'Navigate to the option
Next
WshShell.sendkeys "{ENTER}"
Set WshSEll = nothing
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Ravi,

Thanks very much, I had to tweak the posted code a little, and I can make an assumption that the Close menu item is the first on the popup list, so my final code is:

Code:
Setting.WebPackage("ReplayType") = 2
JavaWindow("ldnGUI").JavaTab("TdiGroup").Click 10,10,"RIGHT"

wait(2)
Set WshShell = CreateObject("WScript.Shell")

WshShell.sendkeys "{ENTER}"
Set WshSEll = nothing

This should help me solve a whole bunch of my popup issues so your response is much appreciated.

David
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP not able to recognize Java Script Popup rakeesh_28 1 2,686 06-26-2012, 12:15 PM
Last Post: vibhakhandelwal
  How to chek focus..Need Help... souvikghosh_diatm 7 8,096 04-03-2012, 03:36 PM
Last Post: rajasekhar
  Capturing PopUp link siwani 0 2,374 06-10-2011, 03:16 AM
Last Post: siwani
Sad How to set focus or click on the center of webpage? brar.arsh 5 11,008 05-26-2011, 02:26 PM
Last Post: souvikghosh_diatm
  Popup page not recognized wheelercha 3 2,967 08-28-2010, 12:27 AM
Last Post: appsved

Forum Jump:


Users browsing this thread: 1 Guest(s)