Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write DP for a pop up window which appears only during execution and changes
#1
Solved: 10 Years, 7 Months, 3 Weeks ago
Hi
I am using windows based application and QTP 10. In middle of the execution a pop up window comes up and I need to write a DP for that.
Problem is the pop up window does not comes up if we do the test manually and also its not fixed when it appears. So I cant use Object Spy for properties. Also the name of the dialog is different everytime it appears. Kindly suggest how I can write DP for this case.
Reply
#2
Solved: 10 Years, 7 Months, 3 Weeks ago
[attachment=1008]Hi Anushree,

there are different ways we can handle this. But I think the best methodology is getting the hwnd of the popup window and then work on that.

Below is the simple code with sample windows application. I have attached the screenshot for better understanding.
Code:
'Step1: Simulate your action to bring the popup window
'Click on the OK button in Login window which will simulate the popup window.
Dialog("Login").WinButton("OK").Click
'Step 2: Get the HWND of the popup window (assuming that the popup window is the top most window)
'Declare the extern
extern.Declare micLong,"GetForegroundWindow","user32.dll","GetForegroundWindow"
'Get the top most window hwnd
hwnd = extern.GetForegroundWindow()
'Step 3: Assign the HWND value to the Object in OR.
'set the hwnd value in object repository
Dialog("TopWindow").SetTOProperty "hwnd",hwnd
'Step 4: Continue working with popup window as usual
'Highlight the top most window
Dialog("TopWindow").highlight
'get the runtime property value (based on your requirement)
msgbox Dialog("TopWindow").GetVisibleText()
msgbox Dialog("TopWindow").GetROProperty("regexpwndtitle")
'perform operation on the top most window objects.
Dialog("TopWindow").WinButton("OK").Click
Please let me know if you need any further help


Attached Files Image(s)
   
Thanks,
SUpputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Not getting error pop up when replaying through batch amit25007 0 1,292 02-14-2017, 04:01 PM
Last Post: amit25007
  Object doesn't support this property or method: 'window(...).window(...).winobject' senthil5683 1 3,477 07-04-2016, 07:08 PM
Last Post: venkatesh9032
  VB Script:number of times a character appears in a string with position Jyobtech 1 11,680 08-07-2013, 01:03 PM
Last Post: anil2u
  Handling pop-up message linhke 8 7,338 07-13-2010, 10:23 AM
Last Post: sasmitakumari
  POP versus OOP paradigm in DP jp@QTP 0 1,898 06-30-2008, 10:33 AM
Last Post: jp@QTP

Forum Jump:


Users browsing this thread: 1 Guest(s)