October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Use isDisplayed() in Selenium

Use Selenium's displayedness check for the current state, or wait for visibility on dynamic pages. Learn the syntax and limits across Python, Java, and JavaScript.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Call is_displayed() in Python or isDisplayed() in Java and JavaScript on a Selenium WebElement to ask whether Selenium considers the element displayed in the current browsing context. The result is a useful state check, not proof that a click or keyboard action will succeed. If the page is still changing, wait for visibility instead of checking once.

Call the method on a located element

First locate the element using a locator suitable for your page, then call the method from your Selenium language binding. The method returns a Boolean in Python and Java; in JavaScript it returns a promise that resolves to a Boolean.

Python

from selenium.webdriver.common.by import By

button = driver.find_element(By.ID, "submit")
if button.is_displayed():
    print("Selenium reports the element as displayed")

Python spells the method is_displayed(). Its documented return type is bool: Python WebElement API.

Java

WebElement button = driver.findElement(By.id("submit"));
if (button.isDisplayed()) {
    System.out.println("Selenium reports the element as displayed");
}

Java spells the method isDisplayed(), which returns boolean: Java WebElement API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

JavaScript

const button = await driver.findElement(By.id('submit'));
const displayed = await button.isDisplayed();
console.log(displayed);

In JavaScript, await the returned Promise<boolean>: JavaScript WebElement API.

What the result means—and what it does not

Selenium describes this as checking whether the connected element is displayed in the current browsing context. Its documentation also cautions that displayedness is not fully defined by the W3C WebDriver specification; Selenium uses a JavaScript-based approximation because every possible condition is difficult to specify. Treat true as Selenium’s displayedness assessment, not a guarantee that every user would perceive the element as visible in every circumstance. See Selenium’s element information documentation (page modified April 17, 2026).

Displayedness is also different from readiness for interaction. Selenium performs additional checks for actions. It may scroll an element into view, but an element that is not displayed or not interactable can cause an element-not-interactable error. If the click’s center is covered by another element, the click can instead fail with an element-click-intercepted error. Details are in Selenium’s interaction documentation.

Wait for visibility when the page is dynamic

A direct call tells you the current state at that moment. It does not wait for a hidden element to appear. In Python, use WebDriverWait with visibility_of_element_located when the page may need time to render:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

button = WebDriverWait(driver, 10).until(
    EC.visibility_of_element_located((By.ID, "submit"))
)

The 10-second timeout is an illustrative value, not a performance recommendation. The Python API reference describes visibility as presence in the DOM plus width and height greater than zero. The related element_to_be_clickable condition requires the element to be visible and enabled; neither condition promises that another element will not obstruct the click. These details are documented in the Selenium Python 4.50.0 expected-conditions reference: expected conditions API. Match the reference and code to the Selenium version installed in your project.

Choose the check that matches the task

Need Use What it establishes
Check state right now element.is_displayed() or the binding’s equivalent Selenium’s current displayedness assessment.
Wait for a located element to become visible (Python) visibility_of_element_located(locator) with WebDriverWait The element is present and has non-zero width and height, per the Python expected-condition documentation.
Wait until a control is visible and enabled (Python) element_to_be_clickable(locator) with WebDriverWait Visibility and enabled state; it does not establish that the eventual click center is unobstructed.
Perform a click or keyboard action Use Selenium’s interaction command and handle its interaction errors The command applies interaction checks beyond a standalone displayedness check.

Troubleshoot common outcomes

  • The method returns false: the element may exist in the DOM but not currently meet Selenium’s displayedness assessment. If it should appear after a page transition or asynchronous update, wait for visibility rather than making a single immediate check.
  • Finding the element fails before the method runs: the locator did not return a WebElement. Check that the locator matches the current page and that the relevant content has loaded; a displayedness method cannot be called until an element has been located.
  • The method returns true but clicking fails: displayedness alone does not prove interactability. Check whether the control is enabled and whether another element covers the click center; consult Selenium’s interaction errors and use a suitable wait for the state you need.
  • The check seems inconsistent on a changing page: the direct call observes one instant. Replace repeated immediate checks with an explicit wait for the desired condition.
  • The example does not match your codebase: use the spelling and return behavior for your binding, and verify against the API reference version matching your installed Selenium package.

Or skip the browser setup

If your goal is to capture a clean image of a page rather than inspect an element in a Selenium test, ScreenshotNeo can return a screenshot or PDF with one GET request. It accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up free for 1,000 screenshots a month, with no card required.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Can isDisplayed() return null?

No. The documented result is a Boolean in Java and Python, and a promise resolving to a Boolean in JavaScript.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does isDisplayed() check whether an element is enabled?

No. Enabled state is separate; Python’s clickable expected condition combines visibility with enabled state.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.