Hero Background

Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

Can you inspect a WebElement with Firebug if WebDriver opens the Browser?

The browser window that WebDriver opens is a normal, fully interactive browser, so you can inspect any WebElement in it, but not with Firebug. Firebug was discontinued in 2017 and no longer works with modern Firefox. Use the built-in DevTools instead: right-click the element and choose Inspect, or press F12, exactly as you would in a manually opened browser.

The only catch is timing: WebDriver closes the window when the test ends, so you need to pause execution to inspect it live. This guide covers how to do that and which modern tools replace Firebug and FirePath.

Why Firebug No Longer Works

Firebug was a Firefox add-on used for years to inspect the DOM and, with the FirePath companion, to build and test XPath and CSS locators for Selenium. Mozilla ended Firebug in 2017 and folded its capabilities into the native Firefox Developer Tools, and the shift to WebExtensions broke the old XPI installs entirely. So any tutorial that tells you to load firebug.xpi into the profile WebDriver launches is outdated; the browser DevTools now do everything Firebug did and more.

Inspecting the WebDriver Browser With DevTools

Because WebDriver drives a real browser, DevTools are already available in the window it opens. The challenge is that the test finishes in seconds and calls driver.quit(), closing the window before you can look. Pause the run with a breakpoint or a temporary sleep so the session stays open:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class InspectDemo {
    public static void main(String[] args) throws InterruptedException {
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.lambdatest.com/selenium-playground/");

        // Pause so the browser stays open and you can right-click and Inspect,
        // or press F12 to open DevTools on the live DOM.
        Thread.sleep(30000);

        driver.quit();
    }
}

With the window held open, right-click the target element and choose Inspect. DevTools highlights the matching node, and from the context menu you can Copy the CSS selector or XPath to paste straight into your locator. Practice against the Selenium Playground to build reliable locators.

Modern Replacements for Firebug and FirePath

  • Browser DevTools (F12): built into Chrome, Firefox, Edge, and Safari. Inspect the DOM, edit live, and copy selectors or XPath.
  • SelectorsHub: a free Chrome and Firefox extension that generates and validates relative XPath and CSS locators, the modern successor to FirePath.
  • ChroPath: a legacy element-inspection extension that many teams migrated to before adopting SelectorsHub.
  • DevTools console: test a locator instantly with document.querySelector() for CSS or $x() for XPath before adding it to your script.

For a deeper reference on building robust selectors, see the TestMu AI guides on locators in Selenium WebDriver and XPath in Selenium, plus the WebDriver learning hub.

Inspecting Elements From Code

You do not always need a visual tool. Once you have located an element, WebDriver can read its properties programmatically, which is ideal for debugging inside the test itself:

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("https://www.lambdatest.com/selenium-playground/")

element = driver.find_element(By.LINK_TEXT, "Simple Form Demo")

# Inspect the element's attributes and state from code
print(element.get_attribute("href"))
print(element.text)
print(element.is_displayed())

driver.quit()

Common Mistakes and Troubleshooting

  • Trying to install Firebug: the XPI is dead on modern Firefox. Use built-in DevTools instead.
  • Window closes too fast: add a breakpoint or temporary sleep before driver.quit() so you can inspect the live DOM.
  • Copied absolute XPath: DevTools often copies a brittle full-path XPath. Rewrite it as a short relative XPath or CSS selector.
  • Inspecting after a dynamic change: AJAX can rebuild the DOM. Re-inspect after the state you actually test, not on first load.
  • Different browser than your test: inspecting in Chrome while the suite runs in Firefox can give selectors that behave differently. Inspect in the same browser.

Inspecting Elements Across Real Browsers at Scale

Local DevTools inspection only covers the one browser on your machine, yet locators can behave differently across engines. When you run Selenium on TestMu AI, every session is recorded with video, step screenshots, and full DOM, console, and network logs, so you can inspect exactly what an element looked like even though the browser ran remotely. The same suite executes cross-browser testing across 3000+ real browsers and devices in parallel, letting you confirm a locator resolves correctly on Chrome, Firefox, Safari, and Edge at once instead of debugging them one at a time.

Conclusion

Yes, you can inspect a WebElement in the browser WebDriver opens, just not with Firebug, which has been dead since 2017. Pause the session so the window stays open, use the built-in DevTools or SelectorsHub to grab reliable selectors, and read element state from code with get_attribute() when you need to debug in the test. To inspect and validate locators across every major browser at once, run your Selenium suite on a real-browser cloud grid.

Frequently Asked Questions

Is Firebug still available for Firefox?

No. Firebug was discontinued in 2017 and is not compatible with modern Firefox. Its features were merged into the built-in Firefox Developer Tools, which you open with F12. Any tutorial that tells you to install the Firebug XPI is outdated.

Can I inspect elements in the browser WebDriver opens?

Yes. The window WebDriver launches is a normal browser, so you can right-click any element and choose Inspect, or press F12 to open DevTools, exactly as you would in a manually opened browser. Add a breakpoint or Thread.sleep to keep the window open long enough to inspect.

What replaced FirePath for building XPath?

FirePath is deprecated. Use the browser DevTools element picker, which lets you copy a CSS selector or XPath directly, or install SelectorsHub, a modern extension for Chrome and Firefox that generates and validates relative XPath and CSS locators.

Why does the browser close before I can inspect it?

WebDriver calls driver.quit() at the end of the test, which closes the window. To inspect interactively, set a breakpoint before quit, comment out quit temporarily, or pause execution so the session stays open while you examine the DOM.

How do I read an element's attributes from code?

Locate the element, then call getAttribute() in Java or get_attribute() in Python to read values like id, class, href, or value. Combined with getText() and isDisplayed(), this lets you inspect element state programmatically during a run.

Can I inspect elements when tests run on a cloud grid?

Yes. Cloud grids record video, capture step-by-step screenshots, and expose full network and console logs for every session, so you can inspect what happened even though the browser ran remotely and there is no local window to open DevTools on.

Related Questions

Test Your Website on 3000+ Browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests