cancel
Showing results for 
Search instead for 
Did you mean: 

.js file

SOLVED
KJ
Occasional Contributor

.js file

Can I launch a .js file from within a Test Complete test?  If so, what are the best practices and common mistakes that occur when trying to do this?

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
BenoitB
Community Hero

Re: .js file

In addition, if yu want to play a plain .js file to execute something, you can call ms script runner (cscript.exe or wscript.exe) by command line.

 

Or you can register in TestedApps cscript.exe/wscript.exe and call it directly without the command line.

 

The command line version allows you to eventually read the console output of your .js execution.

 

 

Un sourire et ça repart

View solution in original post

4 REPLIES 4
tphillips
Community Leader

Re: .js file

TestComplete supports test scripting, and it supports javascript as its test scripts.

From a keyword test you can use the Run Script Routine operation to run a script function.

 

What are you wanting to achieve in running this .js script?


--------------------
QA Systems Architect
ApplePen
Community Leader

Re: .js file

1.The js script that you mentioned is done by TestComplete? 

2.Or you want to run the script out of TestComplete?

 

If it is 1 , please do it as tphillips said.

if it is 2, I haven't any experience. But as I know, you can run js code in TestComplete during testing web.

Like 'pageObj.contentDocument.Script.eval("history.back()");'

Please check the link Run JavaScript on Web Page  in detail.

BenoitB
Community Hero

Re: .js file

In addition, if yu want to play a plain .js file to execute something, you can call ms script runner (cscript.exe or wscript.exe) by command line.

 

Or you can register in TestedApps cscript.exe/wscript.exe and call it directly without the command line.

 

The command line version allows you to eventually read the console output of your .js execution.

 

 

Un sourire et ça repart

View solution in original post

sonya_m
Community Manager

Re: .js file

Thanks everyone for such great help!

@KJ Which advice did you end up using? Please mark the best reply as a Solution!


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors