Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issues while running QTP Script in Siebel.
#21
Solved: 11 Years, 3 Months, 2 Weeks ago
(08-21-2009, 10:12 AM)Saket Wrote: Hi Smita,

would you like to use Windows API in your script?
Try this - Paste the following code into your script or in a library file and call the function 'HandleDialog' where you want to handle the dialog

Code:
Extern.Declare micHwnd, "FindWindowEx", "user32.dll", "FindWindowExA", micHwnd, micHwnd, micString, micString
Extern.Declare micLong, "PostMessage", "user32.dll", "PostMessageA", micHwnd, micLong, micLong, micLong
Extern.Declare micLong, "GetWindow", "user32.dll", "GetWindow", micLong, micLong

Const BM_CLICK = &HF5
Const WM_SETFOCUS = &H7



Public Function HandleDialog()

    pHwnd = extern.FindWindowEx(0,0, vbNullString, "Microsoft Internet Explorer")
    'pHwnd = extern.FindWindowEx(0,0, vbNullString, "Message from webpage")
    extern.PostMessage pHwnd,WM_SETFOCUS,0,0
    If pHwnd > 0 Then
        btnHwnd = extern.FindWindowEx(pHwnd,0,"button" ,vbNullString)

        extern.PostMessage btnHwnd,WM_SETFOCUS,0,0
        wait(5)
        extern.PostMessage btnHwnd,BM_CLICK,0,0
    End If

End Function

Let me know if there is any issue

Saket -
This is a nice piece of code. I was just wondering would it not treat IE as a window since "Microsoft Internet Explorer" is the tag we are providing to search for ?

Smita -
did any of the other solutions help you so far ?
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
#22
Solved: 11 Years, 3 Months, 2 Weeks ago
Basanth - unfortunately I dont have IE6 on my machine now, so not able to try with that. but I am sure that It will treat IE as a window because I think whenever we open an application in IE it takes the name of application as well so until unless we will not pass the whole name or in regualae expression, it will not the the IE, I think the caption comes as - '<<App Name>> - Microsoft Internet Explorer'

hope you are getting what i am trying to explain Smile
Sory Typo - Please read ' It will treat IE as a window because ' as It will not treat IE as a window because '

Reply
#23
Solved: 11 Years, 3 Months, 2 Weeks ago
Yeah got it. Wink I do that typo and if you dont notice it, it gives a total different meaning.Smile Well i guess the risk we have to take is that the app name is being displayed on the title which i hope every developer thinks as a basic common sense during coding Big Grin
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
#24
Solved: 11 Years, 3 Months, 2 Weeks ago
Thanks a lot to you basanth, your last solution really worked well.

This issue got solved which was pending for very very long time.
Reply
#25
Solved: 11 Years, 3 Months, 2 Weeks ago
Excellent !!!
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
#26
Solved: 11 Years, 3 Months, 2 Weeks ago
Basanth,
You may want to write a quick explanation of your approach for everyone (like how you are activating the window , also it would be good to have a link to MSDN for the method used ). We can then stick this thread on top of sub-forums "QTP Others" and make the thread title bit more related to the question asked by OP.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#27
Solved: 11 Years, 3 Months, 2 Weeks ago
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

Ugh...I wrote a lot and everything seems to have got deleted other than the Code :-).

Okay i am going to rewrite the whole stuff.

There are several instances when QTP hangs due to a window appearing on the screen. Reasons debated being several, the core issue is derieved from the very fact about the outlook security window which appears and freezes the qtp script. To negate this situation a execution of a external vbs file which parallelly works to counter the windows presence and hence closing it through the keystrokes helps qtp to proceed further.

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"

This Solution was provided to me by Yaron Assa of the AdvancedQtp Fame.

Let me know if you have any questions.
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
#28
Solved: 11 Years, 3 Months, 2 Weeks ago
(08-24-2009, 07:44 PM)basanth27 Wrote: [/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
[code]
Ugh...I wrote a lot and everything seems to have got deleted other than the Code :-).

Okay i am going to rewrite the whole stuff.

There are several instances when QTP hangs due to a window appearing on the screen. Reasons debated being several, the core issue is derieved from the very fact about the outlook security window which appears and freezes the qtp script. To negate this situation a execution of a external vbs file which parallelly works to counter the windows presence and hence closing it through the keystrokes helps qtp to proceed further.

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"

This Solution was provided to me by Yaron Assa of the AdvancedQtp Fame.

Let me know if you have any questions.
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
#29
Solved: 11 Years, 3 Months, 2 Weeks ago
I am not sure if this issue has been resolved. But here is another solution we tried and it works great.

Prior to the Select method, have the following code
Code:
SiebelApplication("XYZ").SetTimeOut(10)
On Error Resume Next
SiebApplication ......Select "....."
On Error Goto 0

Browser()....Dialog().Click

Thanks MV
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Issues while uft script execution AAB 4 4,817 10-05-2015, 07:23 PM
Last Post: supputuri
  Running QTP scripts without QC sowjanya 3 6,103 07-16-2015, 11:16 AM
Last Post: ravi.gajul
  QTP Siebel: execution issue when form applet button invokes browser dialog box impreetam 2 4,633 02-06-2014, 12:23 AM
Last Post: vsampark
  Windows 8 envirnment error while running QTP script. Rashmi Rajpal 0 2,431 10-10-2013, 12:21 PM
Last Post: Rashmi Rajpal
  QTP does not stop running furqanmlk 2 3,901 08-25-2013, 02:06 PM
Last Post: GregHicks

Forum Jump:


Users browsing this thread: 3 Guest(s)