How to start with Selenium Debugging
On This Page Debugging in SeleniumBreakpoints in SeleniumJune 24, 2026 · 4 min read · Tool Comparison
Debugging is a critical part of automation quiz with Selenium. It helps testers hint failure, analyze control flowing, and identify the root cause of issues in test scripts. By leveraging the correct debugging techniques—such as breakpoints, screenshots, session logs, and testing on real devices—QA team can make their Selenium tests more reliable and easier to preserve. What is Selenium Debugging? How Do Breakpoints Help in Selenium Debugging? How Can Screenshots Support Debugging? This clause explainshow to debug Selenium exam using breakpoints, screenshots, session logging, and real devicefor faster issue firmness and authentic test outcomes. There are multiple manner to debug Selenium code. Let ’ s initiatory understand what breakpoints are and how to use them while debugging. in automation quiz assist us to halt execution at a particular point in our code. When you use a breakpoint at some point in our code, it facilitate debug the code step by step from that point. Let us see how to apply breakpoints and run our code in debug way: Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script. Step 1Place the cursor on the line where you want to apply the breakpoint and pressCtrl+Shift+B. You can also double-click on the left-hand side of the editor window. Here you can see the breakpoint is use in line number 50. Step 2You can place the breakpoint by navigating and takeRun & gt; Toggle Breakpointin the Eclipse editor. Step 3After applying the breakpoint, you can now accomplish the code in debug mode by selectingRun & gt; Debug As & gt; TestNGtest. Using TestNG in this example. You can also right-click anywhere in the broadcast and invoke theDebug as option. Also Read: Step 4After invoking the debug option, your code will start fulfil in debug way, and execution will halt at the breakpoint you apply at line 50. As you can see, the executing has halted at line 50, and it is highlighted in green. The breakpoints tab that is displayed at the correct hand side of the image shows all the breakpoints applied. Step 5There is another “ variables ” tab that expose the values delegate to the variables during execution. You can also see the variable values changing as the executing stream depart from one line to another. Step 6Once the control has reached up to the breakpoint, You can execute a piece of codification or method as a whole (not executing it step by pace) by pressing F6 or Step over icon. Step 7 You can also use the Step Into option to debug the code line by line. Step 8You can stop the step-by-step executing and resume normal execution by pressingF8 or Resume. help us to understand how the test performance has progressed during the execution of test scripts. Selenium let us to take screenshots during the execution of test scripts with the assistant of an interface ringTakeScreenshot. Must Read: Let ’ s see how to use this interface with the help of the below example: As the automation suite grows in size, the number of failures also may grow, and hence it becomes difficult to debug these failure or monitor the entire test execution. At this point, session recording can help us to enter the entire session of executing and save it for future reference. Session recording helps to record the blind states, screen transitions during execution, inputs to different tests, etc. This might help for a detailed understanding of execution flowing and locate exact point of failures. These transcription can also be given as execution evidence to developer and other stakeholders. Selenium perform not provide direct support for session recording, but you can integrate it with a third-party instrument called Monte Media Library. Debugging on real device helps to interpret and debug the covering & # 8217; s behaviour in. BrowserStack offers a platform. You can access over 3000+ different device, browser, and OS combinations using this program. There are different use cases when the test results alter in dev environment and in real user conditions, which is why it is recommended to prove on real devices for accurate test answer. It facilitate deliver seamless and coherent exploiter experience across different device-browser-OS combinations under real world weather. You can run same tests on multiple device-browser combinations saving clip and. # Ask-and-Contributeabout this topic with our Discord community. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.How to start with Selenium Debugging
Overview
Debugging in Selenium
Breakpoints in Selenium
Capturing Screenshots
package screenshotsinselenium; import java.io.File; import org.apache.commons.io.FileUtils; meaning org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; public grade screenshotsexample {@ Test public nihility testBStackTakeScreenShot () throws Exception {WebDriver driver; System.setProperty (`` webdriver.chrome.driver '', '' c: \\chromedriver.exe ''); driver = new ChromeDriver (); driver.get (`` https: //www.browserstack.com ''); //calling the screenshot function this.takeScreenShot (driver, `` D: //BSTest.png '');} public static void takeScreenShot (WebDriver webdriver, String fileWithPath) shed Exception {//1. We need to convert webdriver object to TakeScreenshot TakesScreenshot scrShot = ((TakesScreenshot) webdriver); //2. Calling the method getScreenshotAs and specify the output type of screenshot. File SourceFile=scrShot.getScreenshotAs (OutputType.FILE); //3. Then displace the screenshot to the finish path where we ask to copy our file File DestinationFile=new File (fileWithPath); //4. simulate the file FileUtils.copyFile (SourceFile, DestinationFile);}}Session Logging
Debugging on Real Devices
Related Guides
Automate This With SUSA
Test Your App Autonomously