Quantcast
Channel: LoadRunner Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3978

TC 12.53 JavaScript syntax debugging outside of TC/LR

$
0
0

I am not sure how often this will be helpful, but I ran into one situation already: debugging and correcting a malformed string. Many (perhaps all) of the syntax errors you code in TC will result in line #X being called out as the offending problem, but not the first character that starts the syntax error. When that occurs, if it is possible to evaluate the string outside the context of your TC script, you can try using the Windows Scripting Host support for JavaScript on any recent Windows desktop.

You create and edit a file with the .jsextension, and then to run that script simply double click it. Unfortuately the object names differ from the TC environment but this set of 4 lines of a WSH JavaScript should give you a decent starting point to hack a quick script to work with (at least) string syntax problems:

ws = WScript.CreateObject('WScript.Shell');
buttonCaption = " Generate ";


ws.Popup("//button[text()='" + buttonCaption + "']");

ws.Popup("//button[text()=\"" + buttonCaption + "\"]");

Now if either of the above strings used with the Popup method (that generates a Window's Alert popup) you will get an error message identifying the first char where the syntax is supposed to be bad.

 

-Hope this helps, Terry Horwath


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>