Motivation
The Console tab in DevTools can be a helpful resource for manual exploratory testers. It provides insights and tools to enhance the testing process. This article aims to simplify understanding the Console tab's features and demonstrate how testers can leverage them to identify issues, debug code, and streamline testing efforts.
What is the Console Tab?
Imagine a website as a machine. The Console tab is like a control panel that shows messages the machine sends about its inner workings. These messages can be helpful clues if something isn't working right.
Getting to the Console:
Open your browser and visit any website.
Right-click anywhere on the page and select ❝Inspect❞ or ❝Inspect Element❞ or hotkeys
Cmd + Option + I
(macOS) orCtrl + Shift + I
(Windows or Linux).This opens the developer tools. Look for a tab labelled ❝Console❞ and click on it.
What's Inside the Console?
Messages: The website might send messages about errors, warnings, or helpful information. Look for red text, which usually indicates errors.
Input Bar: This is where you can type commands and see the results instantly. It's like giving the machine instructions and seeing its response.
How Can Testers Use the Console?
Check for Errors: When you encounter a bug, open the Console and see if any error messages appear. These messages can point you towards the source of the problem.
Take, for instance, clicking CREATE YOUR FREE PROFILE is not navigating users anywhere with the help of the Console; we can see that clicking the element triggers the console error: TypeError: Undefined is not an object (evaluating 'n.identity.authenticate'
:
This console error provides more information about what the bug is since the reasons for not triggering any visible outcome can be many, but now we've narrowed down the possible root causes since this error indicates that the code is trying to access a property (authenticat
) of an object (identity
) that doesn't exist (undefined
).
Simulate Actions: Want to test a form without filling it out? You can try typing commands in the input bar to mimic user actions and see how the website reacts.
Sometimes, we don't get errors when clicking buttons, but we can simulate clicking on them on the Console by copying the JS path of the elements and placing it at the end of the document.selector("[paste the selector here]")
and then add the click click();
This is the straightforward way to implement one of the numerous methods in JavaScript for selecting and accessing elements within an HTML document.
The outcome of this method is the same error as above. If there is no action, then the problem is likely related to the event listener of this button when clicking it.
Inspect Values: Click on an element on the webpage (like a button) and then look at the Console. You might see information about that element, helping you understand its functionality.
We can use the same method to inspect the values of HTML elements without the click event. By using document.selector("[paste the selector here]")
Then, by pressing return/enter, we get the values of any element.
Remember:
You don't need to understand complex code to use the Console effectively. Look for red error messages and experiment with simple commands using the input bar.
The Console is a powerful tool for testers to find clues and report bugs more precisely.
Bonus Tip: Many browsers offer tutorials on their developer tools. Explore them to learn more advanced Console tricks and become a website inspection pro!