![Selenium Tutorial](/selenium/images/selenium-mini-logo.jpg)
- Selenium Tutorial
- Selenium - Home
- Selenium - Overview
- Selenium - Components
- Selenium - Automation Testing
- Selenium - Environment Setup
- Selenium - Remote Control
- Selenium IDE Tutorial
- Selenium - IDE Introduction
- Selenium - Features
- Selenium - Limitations
- Selenium - Installation
- Selenium - Creating Tests
- Selenium - Creating Script
- Selenium - Control Flow
- Selenium - Store Variables
- Selenium - Alerts & Popups
- Selenium - Selenese Commands
- Selenium - Actions Commands
- Selenium - Accessors Commands
- Selenium - Assertions Commands
- Selenium - Assert/Verify Methods
- Selenium - Locating Strategies
- Selenium - Script Debugging
- Selenium - Verification Points
- Selenium - Pattern Matching
- Selenium - JSON Data File
- Selenium - Browser Execution
- Selenium - User Extensions
- Selenium - Code Export
- Selenium - Emitting Code
- Selenium - JavaScript Functions
- Selenium - Plugins
- Selenium WebDriver Tutorial
- Selenium - Introduction
- Selenium WebDriver vs RC
- Selenium - Installation
- Selenium - First Test Script
- Selenium - Driver Sessions
- Selenium - Browser Options
- Selenium - Chrome Options
- Selenium - Edge Options
- Selenium - Firefox Options
- Selenium - Safari Options
- Selenium Web Elements
- Selenium - File Upload
- Selenium - Locator Strategies
- Selenium - Relative Locators
- Selenium - Finders
- Selenium - Find All Links
- Selenium - User Interactions
- Selenium - WebElement Commands
- Selenium - Browser Interactions
- Selenium - Browser Commands
- Selenium - Browser Navigation
- Selenium - Alerts & Popups
- Selenium - Handling Forms
- Selenium - Windows and Tabs
- Selenium - Handling Links
- Selenium - Input Boxes
- Selenium - Radio Button
- Selenium - Checkboxes
- Selenium - Dropdown Box
- Selenium - Handling IFrames
- Selenium - Handling Cookies
- Selenium - Date Time Picker
- Selenium - Dynamic Web Tables
- Selenium - Actions Class
- Selenium - Action Class
- Selenium - Keyboard Events
- Selenium - Key Up/Down
- Selenium - Copy and Paste
- Selenium - Handle Special Keys
- Selenium - Mouse Events
- Selenium - Drag and Drop
- Selenium - Scroll Operations
- Selenium - Waiting Strategies
- Selenium - Explicit/Implicit Wait
- Selenium - Support Features
- Selenium - Multi Select
- Selenium - Wait Support
- Selenium - Select Support
- Selenium - Color Support
- Selenium - Errors & Logging
- Selenium - Exception Handling
- Selenium - Miscellaneous
- Selenium - Handling Ajax Calls
- Selenium - JSON Data File
- Selenium - CSV Data File
- Selenium - Excel Data File
- Selenium - Cross Browser Testing
- Selenium - Multi Browser Testing
- Selenium - Multi Windows Testing
- Selenium - JavaScript Executor
- Selenium - Headless Execution
- Selenium - Capture Screenshots
- Selenium - Capture Videos
- Selenium - Page Object Model
- Selenium - Page Factory
- Selenium - Record & Playback
- Selenium - Frameworks
- Selenium - Browsing Context
- Selenium Grid Tutorial
- Selenium - Overview
- Selenium - Architecture
- Selenium - Components
- Selenium - Configuration
- Selenium - Create Test Script
- Selenium - Test Execution
- Selenium - Endpoints
- Selenium - Customizing a Node
- Selenium Reporting Tools
- Selenium - Reporting Tools
- Selenium - TestNG
- Selenium - JUnit
- Selenium - Allure
- Selenium & other Technologies
- Selenium - Java Tutorial
- Selenium - Python Tutorial
- Selenium - C# Tutorial
- Selenium - Javascript Tutorial
- Selenium - Kotlin Tutorial
- Selenium - Ruby Tutorial
- Selenium - Maven & Jenkins
- Selenium - Database Testing
- Selenium - LogExpert Logging
- Selenium - Log4j Logging
- Selenium - Robot Framework
- Selenium - AutoIT
- Selenium - Flash Testing
- Selenium - Apache Ant
- Selenium - Github Tutorial
- Selenium - SoapUI
- Selenium - Cucumber
- Selenium - IntelliJ
- Selenium - XPath
- Selenium Miscellaneous Concepts
- Selenium - IE Driver
- Selenium - Automation Frameworks
- Selenium - Keyword Driven Framework
- Selenium - Data Driven Framework
- Selenium - Hybrid Driven Framework
- Selenium - SSL Certificate Error
- Selenium - Alternatives
Selenium IDE - Script Debugging
Selenium IDE provides multiple script debugging options with the help of which we can troubleshoot scripts on failures, or for any other purposes. A debugging of a script is done to ensure that the script should run as it is intended to do by investigating and solving errors, if any.
There are multiple debugging techniques and features available in Selenium IDE.
Step-By-Step Execution
The Step over current command button allows you to run the test step by step and examine if something is not working.
![Selenium Script Debugging 1](/selenium/images/selenium_script_debugging_1.jpg)
On clicking on this button repeatedly, we can see if any of the test steps are not working as expected. In the below image, the step 1 executed successfully, after we clicked the Step over current command button. Then Paused in debugger appeared along with the next step to be executed(here the step2) became yellow.
![Selenium Script Debugging 3](/selenium/images/selenium_script_debugging_3.jpg)
In the below image now it shows another button Resume test execution. We can also click on it and re-trigger the execution.
![Selenium Script Debugging 2](/selenium/images/selenium_script_debugging_2.jpg)
Once again when the Step over current command button is clicked, the step2 will be executed, and so on.
![Selenium Script Debugging 4](/selenium/images/selenium_script_debugging_4.jpg)
As the execution has been completed, we would get the message of the result. In case the test passed, we would get the message - <TEST NAME> completed successfully under the Log tab at the bottom of the Selenium IDE. Here, our test name is Test4, hence received the message - Test4 completed successfully.
Apart from that, all the test steps, along with the test case name turned green, reflecting a PASS for all the steps. All the steps which reflected under the Log tab, showed an OK in green.
Adding Breakpoints
We can click on the line numbers in the test to add breakpoints in order to debug test steps in Selenium IDE. In the below image, we have added breakpoints to line numbers 2, and 3 (highlighted in blue in Selenium IDE).
![Selenium Script Debugging 5](/selenium/images/selenium_script_debugging_5.jpg)
After which, when we run the test, the execution will first automatically stop in line 2. Then the Paused in debugger appeared along with the next step to be executed (here the step2) becomes yellow.
We will click again on the Step over current command button which will help us to continue with the next step of execution.
![Selenium Script Debugging 6](/selenium/images/selenium_script_debugging_6.jpg)
The same process will be repeated, once we move to the next step.
![Selenium Script Debugging 7](/selenium/images/selenium_script_debugging_7.jpg)
Once the execution would be completed, we would get the message of the result. In case the test passed, we would get the message - <TEST NAME> completed successfully under the Log tab at the bottom of the Selenium IDE. Here, our test name is Test4, hence received the message - Test4 completed successfully.
Apart from that, all the test steps, along with the test case name turned green, reflecting a PASS for all the steps. All the steps which reflected under the Log tab, showed an OK in green.
![Selenium Script Debugging 8](/selenium/images/selenium_script_debugging_8.jpg)
We can disable all the breakpoints by clicking the Disable breakpoints button. All breakpoints would get enabled on clicking the same button again.
![Selenium Script Debugging 9](/selenium/images/selenium_script_debugging_9.jpg)
The breakpoints can also be removed/added to steps by right clicking on any step, and selecting the option Toggle Breakpoint.
![Selenium Script Debugging 10](/selenium/images/selenium_script_debugging_10.jpg)
Debugger Command
We can programmatically pause Selenium IDE tests by using the JavaScript command debugger. We would need to right click on a step and select the option Insert new command.
![Selenium Script Debugging 11](/selenium/images/selenium_script_debugging_11.jpg)
Enter debugger in the Command field to pause the execution.
![Selenium Script Debugging 12](/selenium/images/selenium_script_debugging_12.jpg)
Once the test execution is triggered, the control will stop in the debugger step and we will need to resume execution using the Resume test execution button. Then the Paused in debugger along with the test name would become yellow.
![Selenium Script Debugging 13](/selenium/images/selenium_script_debugging_13.jpg)
Once the execution would be completed, we would get the message of the result. In case the test passed, we would get the message - <TEST NAME> completed successfully under the Log tab at the bottom of the Selenium IDE. Here, our test name is Test5, hence received the message - Test5 completed successfully.
Apart from that, all the test steps, along with the test case name turned green, reflecting a PASS for all the steps. All the steps which reflected under the Log tab, showed an OK in green.
![Selenium Script Debugging 14](/selenium/images/selenium_script_debugging_14.jpg)
Pause on Exceptions
The Pause on Exception feature in Selenium IDE helps to pause the exception of a test in case an error is encountered. Once paused, we can rectify the step and resume execution.
Let us take the example discussed previously, and intentionally we would fail a step in that test case, by changing the locator id value in line 2. Here, we have changed the locator value to id=names.
![Selenium Script Debugging 15](/selenium/images/selenium_script_debugging_15.jpg)
Once the execution is completed, we would get the failed test and the rest of the test steps after the failed step would not get executed.
![Selenium Script Debugging 16](/selenium/images/selenium_script_debugging_16.jpg)
However, to prevent the execution from being aborted, we would need to click on the Pause on exceptions button, and then run the test again.
![Selenium Script Debugging 17](/selenium/images/selenium_script_debugging_17.jpg)
In the below image, the execution stopped at line 2 (due to incorrect locator value) with the Paused in debugger along with the test name turning yellow.
![Selenium Script Debugging 20](/selenium/images/selenium_script_debugging_20.jpg)
We will correct the locator value from id=names to id=name and again click on the Resume test execution button.
![Selenium Script Debugging 18](/selenium/images/selenium_script_debugging_18.jpg)
Once the execution would be completed, we would get the message of the result. In case the test passed, we would get the message - <TEST NAME> completed successfully under the Log tab at the bottom of the Selenium IDE. Here, our test name is Test5, hence received the message - Test5 completed successfully.
Apart from that, all the test steps, along with the test case name turned green, reflecting a PASS for all the steps. All the steps which reflected under the Log tab, showed an OK in green.
![Selenium Script Debugging 19](/selenium/images/selenium_script_debugging_19.jpg)
This concludes our comprehensive take on the tutorial on Selenium IDE - Script Debugging. We’ve started with describing an example and walked through the different debugging strategies like the step-by-step execution, adding breakpoints, debugger command, Pause on exceptions, and illustrating how to use them along with Selenium. This equips you with in-depth knowledge of the debugging strategies in Selenium IDE. It is wise to keep practicing what you’ve learned and exploring others relevant to Selenium to deepen your understanding and expand your horizons.