Micro Focus QTP (UFT) Forums
If I run my script in new browser then script fails, - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: If I run my script in new browser then script fails, (/Thread-If-I-run-my-script-in-new-browser-then-script-fails)



If I run my script in new browser then script fails, - babyrajani - 04-13-2009

If I run my script in new browser then script fails, reason QTP is not understanding onBlur event.
But if I run the same script second time without closing previously opened browser it is working fine.

Ordering of fields are
1. Text box1
2. Drop down ( Drop down is auto populated on the blur event of Text box1)
3. Text box2

Code is like
Code:
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","","C:\Documents and Settings\admin","open"

Browser("Browser").Page("Welcome to PAYMENT").Frame("HtmlFrame").WebEdit("CARDNUMBER" ).Set DataTable("CARD_NUMBER", dtLocalSheet)

Browser("Browser").Page("Welcome to PAYMENT").Frame("HtmlFrame").WebEdit("CARDNUMBER").FireEvent("onblur")

I am not able to understand why same script works If I keep the previously opened browse, since code is to open the new browser everytime.


RE: If I run my script in new browser then script fails, - Tarik Sheth - 04-13-2009

Can you try following.

object.FireEvent EventName, [x], [y], [BUTTON]
in case of left button '0' and right button '0' and try giving x and y coordinate.


RE: If I run my script in new browser then script fails, - babyrajani - 04-24-2009

Hi,
I am not clicking on the drop down to select value. I enter some text in the text box 1 and based on that text, value of drop down gets populated. But If i fill up the form manually then it is working fine. If I run the script then it is not working.

Now to resolve this issue, I am directly entering the URL in Record and Run setting box and script is working fine. (seems strange solution, but working for now)
Previously I was using
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","","C:\Documents and Settings\admin","open"
to open the browser.


Thanks
Rajani


RE: If I run my script in new browser then script fails, - rajaselvan.d - 05-11-2009

can you try wait command

Give wait command after entering first text box script line

Code:
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","","C:\Documents and Settings\admin","open"

Browser("Browser").Page("Welcome to PAYMENT").Frame("HtmlFrame").WebEdit("CARDNUMBER" ).Set DataTable("CARD_NUMBER", dtLocalSheet)
Wait(5)
Browser("Browser").Page("Welcome to PAYMENT").Frame("HtmlFrame").WebEdit("CARDNUMBER").FireEvent("onblur")

See you can use direct application URL in systemutill command not necessary to open IE if your application is web app