Sometimes you may need some additional guidance while working through our lessons, in these scenarios, you can add a print statement to your code and get output to help you debug! Keep in mind, you will need to interact with the target application to trigger output and that interaction is dependent on the lesson instructions (login, add post etc.)
โ
For printing debug statements, do not use the browser console for output. This tab will act like your development terminal/console.
Also helpful: Why don't I see output during tests?
See below for an example of printing output in each of our supported languages:
Clojure
(println "debug")
C# / .NET
using System;
...
Console.WriteLine("debug");
Go
import ( "fmt" )
...
fmt.Println("debug")
Java
System.out.print("debug");
Node
console.log("debug");
PHP
echo "debug";
Python
print("debug")
Ruby
puts "debug"
SQL Injection Part 1 Example:
First, put a print statement in the code editor. In this case, we are putting a print statement in the login function and having it return "Login"
Next, go back to the Target Application and log in since this is the functionality your print statement exists in.
After you log in you will see the Sandbox Output will now have output in it.
If you open the Sandbox Output you will see your print statement has been posted.