Highlighted
Absent Member.
Absent Member.
1117 views

TC: conditionally executing window.alert()

Jump to solution

I am using FF to develop a TC 12.53 script. I am using some Eval JS code window.alert(...); statements to debug the script and inspect parameter values, as in:

TC.log.jpg

But when I execute that script under vuGen the script hangs on the first of these statements, without the popup alert dialog being presented so it can be manually dismissed. (and even if the dialog is presented under vuGen, I can see the obvious problem attempting to run the script under a Controller).

So is there anyway to condition these Steps (surrounded by some type of IF(...) statement) so that they are only executed when I am in Develop Script mode? Or do I have to manually disable all of these Steps before exiting Develop Script mode?

-Thanks, Terry

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Super Contributor.
Super Contributor.

Re: TC: conditionally executing window.alert()

Jump to solution

Hi,

we are using window.alert function for debugging purpose in "Develop Script " mode,So after debugging we have remove or disable the alerts in develop mode

if you run the test with out disabling the window.alert in Vugen ,it will keep on waiting till End Event " Automaic: Action completed" ocuurs,so we have stop the scrit manually in Vugen..

if you want alert function in Vugen for dubugging purpose, enable the "Show run time viewer during reply",for this follw the below steps

1) Go to Vugen-->Option-->Scripting-->Repley-->During Repley -->select "Show run time viewer during reply"

2) Go to script folder, Open default.cgf file ,give   "PaintWindowsInLoad=1"   (Default is 0)

then if run the test in Vugen,it opens FF Browser window

At perticular step which you are using alert function ,Browser window will display the alert,if you press ok, then  it will go the next step of the Vugen script.

 

Thanks,   Ravi

 

 

 

View solution in original post

3 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: TC: conditionally executing window.alert()

Jump to solution

Hi,

we are using window.alert function for debugging purpose in "Develop Script " mode,So after debugging we have remove or disable the alerts in develop mode

if you run the test with out disabling the window.alert in Vugen ,it will keep on waiting till End Event " Automaic: Action completed" ocuurs,so we have stop the scrit manually in Vugen..

if you want alert function in Vugen for dubugging purpose, enable the "Show run time viewer during reply",for this follw the below steps

1) Go to Vugen-->Option-->Scripting-->Repley-->During Repley -->select "Show run time viewer during reply"

2) Go to script folder, Open default.cgf file ,give   "PaintWindowsInLoad=1"   (Default is 0)

then if run the test in Vugen,it opens FF Browser window

At perticular step which you are using alert function ,Browser window will display the alert,if you press ok, then  it will go the next step of the Vugen script.

 

Thanks,   Ravi

 

 

 

View solution in original post

Highlighted
Absent Member.
Absent Member.

Re: TC: conditionally executing window.alert()

Jump to solution

Thanks Ravi. So more manual twiddling to disable these statements before executing in vuGen and/or the Controller.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: TC: conditionally executing window.alert()

Jump to solution

Hi Terry,

Using 'window.alert' is not a good practice, as it blocks the run of the script and may not work.

I'd strongly suggest using TC.log instead.

It will write the values you're interested in to the log, where you can review them after the replay for both interactive and load mode.

 

Edo

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.