Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP hangs on handling error window
#1
My Requirement: When i click on a button in a dialog box, a window should come where as i need to click on OK button. Below is the code
**********************************
Code:
JavaWindow("My Teamcenter - Teamcenter").JavaWindow("My Teamcenter_Newdesign").JavaDialog("Remote Export Options").JavaTab("JTabbedPane").Select "Advanced" JavaWindow("My Teamcenter - Teamcenter").JavaWindow("My Teamcenter_Newdesign").JavaDialog("Remote Export Options").Activate JavaWindow("My Teamcenter - Teamcenter").JavaWindow("My Teamcenter_Newdesign").JavaDialog("Remote Export Options").JavaButton("<<").click ' For loop to handle the window which occurs multiple times Set objUnableWdw = JavaWindow("My Teamcenter - Teamcenter").JavaWindow("Shell").JavaWindow("Unable To Include Relation") For i=0 to 10 If objUnableWdw.Exist(2) Then objUnableWdw.Activate objUnableWdw.JavaButton("OK").Click else Exit For End If

'**********************

In the above code, when I click on "<<" button, QTP gets hanged. If I handle that error window manually, the issue not happening.
Please advise how to handle this
Reply
#2
Do not use the For Loop. Instead use the below code per the instructions i have written below,
Code:
Set fso = CreateObject("WScript.Shell") While fso.AppActivate("Your Window Name") = FALSE wscript.sleep 1000 Wend fso.SendKeys "a", True fso.SendKeys "N", True wscript.sleep 7000 While fso.AppActivate ("Your Window Name") = FALSE wscript.sleep 1000 Wend fso.SendKeys "N", True

How to use:
1. Save the above code as dialoghandler.vbs on your c:\ drive.
2. Be sure to modify the code to replace the window title or name.
3. Replace the appropriate keystrokes you need to send for the dialog. [ for eg :you may need to press "Enter" which inturn actually clicks on "OK" or "cancel" button.
4. Just before the line on QTP where the code executes and freezes QTP, enter this code,
SystemUtil.Run "C:\Windows\System32\Wscript.exe", "C:\dialoghandler.vbs"
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Difference between error handling and exception handling venkatbatchu 6 28,562 12-11-2018, 05:11 PM
Last Post: smitapawar610
  Fireevent ondblclick hangs QTP until window is closed Andor 2 1,874 06-01-2015, 08:10 PM
Last Post: Andor
  UFT 12 hangs on a line (.NET forms) sara- 0 2,858 10-22-2014, 03:51 PM
Last Post: sara-
  QTP hangs Girish S 0 2,139 03-03-2014, 01:13 PM
Last Post: Girish S
  QTP hangs when application error Windows displays rj_hogan 0 3,021 11-07-2011, 04:01 PM
Last Post: rj_hogan

Forum Jump:


Users browsing this thread: 1 Guest(s)