Creo.JS Debugger
JavaScript code might contain syntax or logical errors that can be difficult to diagnose. These errors do not have indications and need to be debugged in a runtime environment. In Creo Parametric 7.0.2.0 and later you can debug Creo.JS code by using Chrome DevTools(CDT). The Creo.JS toolkit uses a Chrome V8 JavaScript engine that runs within the Creo process and supports the standard CDT protocol. This process enables you to use the remote debugger through DevTools provided by the Chrome Web browser.
To Debug Using Chrome Remote Debugger
CDT debugger establishes a connection with Creo.JS instance in the V8 inspector protocol through a Web socket within the internal Creo.JS Web server. To make a debugger connection, the internal Creo.JS Web server must be started. To start the internal Web server, perform the following steps:
1. Manually configure Creo to specify the desired Web server port by editing the creo_js_app.conf file located in your working directory.
2. You can use a special Web page start_creojs_debugger.html to check the status of the Creo.JS Web server.
Note
The start_creojs_debugger.html file is used to invoke the special Web page and is included in the Creo installation at <creojs_loadpoint>\creojs\creojsweb location.
3. To start the Web server, open the start_creojs_debugger.html file in the embedded browser by specifying the full path of the file. After the page opens, you get a link for connecting to the Creo.JS via Chrome remote debugger. For example, if the Creo.JS Web server starts on port 8080, you will get the following message:
Creo.JS debugger
Creo.JS web server is started on port 8080.
To debug your CreoJS code please do the following: 
1. Open Chrome browser
2. Open the link in a browser window

devtools://devtools/bundled/inspector.html?v8only=true&ws=127.0.0.1:8080/debug

3. In the Creo embedded browser open a page you want to debug
4. In the Console bottom panel select a context
 (usually title of the page to debug) you plan on debugging
You can also start the Web server using the startWebServer{port_number} function which can be invoked using the script_engine_testing.html web tool.
Note
If you want to start the Creo.JS Web server manually, the port number in the above link should be replaced with the configured port number from the creo_js_app.conf file located in your working directory.
4. After the remote debugger opens, you can perform various operations using the toolset provided in the debugger, such as browsing the source of Creo.JS scripts, setting break points in debugging scripts, viewing local variables of the current context, evaluating expressions within the current context, and switching between different Creo.JS contexts. For more details about the various operations that can be performed in the debugger, refer to the start_creojs_debugger.html page.
5. If you are using Chrome DevTools for the first time, you will see a window similar to the following image:
Image
6. You can switch to the Sources tab if you want to access the Creo.JS scripts and perform other operations such as call stack view, local and global variables, and break points.
Image
7. Although you can see a separate Console tab, it is recommended that you use the Console tab next to the Sources tab.
Image
8. In the Console tab, you can see the context that you have currently selected and the text area where the console commands can be executed. You can see the behavior of the functions present in the present context.
Image
Example 1: Debugging Creo.JS script
If you have already started the Creo.JS Web server and opened the Chrome remote debugger using the link provided on the start_creojs_debugger.html page, you can refer to the below example to see how debugging works. The following example is an illustration of the operations that you can perform in the debugger.
1. Open the script_engine_testing.html web tool in the embedded browser by specifying the full path of the file as <creojs_loadpoint>\creojs\creojsweb directory.
2. Type the script:
function toTestStepIn(msg) {
   		 print (`toTestStepIn (${msg})`);
}
function toTestStepOver (msg) {
   		 print (`toTestStepOver (${msg})`);
   		 toTestStepIn (`wrapping message [${msg}]`);
   		 print ("Exiting from toTestStepOver()");
}
print ("Functions toTestStepOver() and toTestStepIn() are defined");
3. Click Save As in the embedded browser to save the script as dbg_test.js file.
4. Click Run to execute the script. The remote debugger page opens in your default browser.
5. In the remote debugger, click Page on the Sources tab. Navigate to the dbg_test.js file to open the file in the center panel.
6. Ensure that you open Creo JS.Link Shell as the context in the context list of the Console tab as shown in the image:
Image
7. Set up the break point at line 2 of the script by clicking on the left side of the line number as shown in the image:
Image
8. To manually execute the function, type toTestStepOver ('my test message') in the Console tab and press ENTER.
Note the following important points:
•  Script execution stops at line 2 where the break point is set.
•  In the right side of the panel, Call Stack option displays the current function is toTestStepIn and the earlier one is toTestStepOver.
•  You can see the local and global variables in the Scope option.
9. Click Image on the right side of the panel to continue with the script execution.