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

To retrieve a div in Ext JS, use Ext.get('myDiv'). It returns an Ext.dom.Element wrapper, or null when no matching element exists. If another API needs the browser’s native node, pass that result to Ext.getDom. If “capture” means creating an image, element lookup is only the first step: pass the native node to a DOM-to-canvas library such as html2canvas, or capture the rendered page with a screenshot service.

First decide what “capture” means

In Ext JS discussions, capture a div can describe two different jobs:

  • Retrieve the element: find a rendered div so you can read, modify, hide, measure, or attach listeners to it.
  • Capture an image: render that div as a PNG or another image format.

These jobs use different APIs. Ext.get does not take a picture; it wraps an existing DOM node. An image requires a second operation, normally a DOM-to-canvas library or a browser screenshot.

Get a div by its ID with Ext.get

For a stable HTML ID, call Ext.get without a CSS # prefix:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
var el = Ext.get('myDiv');

if (el) {
    el.addCls('is-selected');
} else {
    Ext.log('myDiv is not in the DOM yet');
}

Sencha documents Ext.get as an alias for Ext.dom.Element.get. The argument may be an ID string, an HTMLElement, or an existing Ext.dom.Element. The return value is an Ext wrapper or null when there is no match.

Ext.get('foo') is correct for an element whose ID is foo. Ext.get('#foo') is incorrect because the method expects the ID itself, not a CSS selector.

Check the result before using it

Calling methods on a null result causes an error. Check the value when the element might be conditionally rendered, destroyed with a component, or not yet inserted into the document. If you control the markup, use an ID that is unique and stable rather than an autogenerated component ID.

Convert the Ext wrapper to a native DOM node

Ext JS methods and browser APIs do not always accept the same object. Use Ext.getDom when a library expects an HTMLElement:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
var el = Ext.get('myDiv');
var domNode = Ext.getDom(el);

if (domNode) {
    domNode.setAttribute('data-captured', 'true');
}

If the ID is known, you can pass it directly:

var domNode = Ext.getDom('myDiv');

The node must already exist when Ext.getDom runs. A component configuration or an HTML template is not enough; the element has to be rendered into the DOM. When the element is absent, treat the result as unavailable and wait for the appropriate render event rather than retrying in a tight loop.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Find a div when it has no ID

Start with a known root and use a CSS selector. Scoping the search to a component element avoids accidentally matching a similarly named element elsewhere on the page.

var root = Ext.get('panelBody');

var first = root.selectNode('div.card');       // first matching node
var all = root.query('div.card');              // HTMLElement[]
var wrapped = root.query('div.card', false);   // Ext.dom.Element[]
var group = root.select('div.card', true);      // composite Ext collection

These methods all accept CSS selectors, but their cardinality and return types differ:

Method Scope Result Use it when
selectNode(selector) The root element The first matching node You need one match and want a single element.
query(selector) The root element An array of native HTMLElement objects by default You need every match for browser APIs or iteration.
query(selector, false) The root element An array of Ext.dom.Element wrappers You need Ext methods on each result.
select(selector, true) The root element A composite collection of Ext elements You want collection operations on a group.

The documented query implementation delegates to querySelectorAll, so ordinary CSS selector rules apply. If root itself is missing, stop before calling these methods.

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

Make sure the element is rendered before looking it up

Timing is the most common reason a correct selector returns nothing. Code that runs while an Ext component is being configured can execute before its body has been inserted into the document.

For static markup

Run the lookup after the DOM is ready:

Ext.onReady(function () {
    var el = Ext.get('myDiv');
    if (!el) {
        Ext.log('Expected div was not rendered');
        return;
    }
    // Safe to use el here.
});

For an Ext component

Use the component’s render or after-render lifecycle point, then obtain its element. The exact event depends on whether you need the component’s outer element or a child in its body:

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
var panel = Ext.create('Ext.panel.Panel', {
    renderTo: Ext.getBody(),
    width: 320,
    height: 180,
    html: '<div class="card" id="myDiv">Ready</div>',
    listeners: {
        afterrender: function (cmp) {
            var card = Ext.get('myDiv');
            if (card) {
                card.addCls('rendered');
            }
        }
    }
});

If a component can be destroyed and recreated, do not retain an old wrapper indefinitely. Resolve the current node after the new render and release references when the component is destroyed.

Capture the div as an image with html2canvas

Once you have a native node, pass it to html2canvas:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
var domNode = Ext.getDom('myDiv');

if (!domNode) {
    Ext.log('Cannot capture a div that has not rendered');
} else {
    html2canvas(domNode).then(function (canvas) {
        document.body.appendChild(canvas);
    });
}

The returned canvas is an image-like representation that you can display, convert to a data URL, or draw elsewhere. For a downloadable PNG:

html2canvas(domNode).then(function (canvas) {
    var link = document.createElement('a');
    link.download = 'myDiv.png';
    link.href = canvas.toDataURL('image/png');
    link.click();
});

What html2canvas actually captures

html2canvas reconstructs the picture from the DOM and the style information available to the browser; it is not a pixel-for-pixel screenshot of the compositor. Its documentation warns that the result may not be 100% accurate to the real representation.

  • CSS that the library does not support may be missing or rendered differently.
  • Images from another origin require same-origin access or a proxy. If the canvas becomes tainted, browser security prevents reading it with toDataURL or similar APIs.
  • Plugins are not rendered.
  • Content inside a cross-origin iframe cannot be inspected because of browser security restrictions.

Wait until fonts, images, and Ext-generated content have loaded before calling the library. If the div is hidden with display:none, there is no visible layout to reconstruct; capture a visible clone or make the element visible during the operation.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Choose the right approach

Requirement Recommended approach Why
Change classes, text, or styles Ext.get Returns an Ext wrapper with Ext JS element methods.
Use a browser API or third-party library Ext.getDom Provides the native HTMLElement.
Process several matching divs query or select Lets you choose native arrays or an Ext composite.
Generate an image inside the browser html2canvas No server round trip, but fidelity and cross-origin rules apply.
Need a browser-rendered page image or PDF from a URL ScreenshotNeo Runs the capture remotely and can remove common overlays before billing.

Or skip the browser setup

If your Ext JS application is reachable at a URL, ScreenshotNeo can capture the rendered page without adding html2canvas to the app. Its API supports full-page captures and capturing one element by CSS selector; see the ScreenshotNeo documentation for the selector option and the other capture parameters.

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

A basic PNG, JPEG, or WebP request is one GET:

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

Python:

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com/extjs-page"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com/extjs-page' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

Before capture, ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Every plan includes the same feature set. Current monthly options are:

Plan Included shots Price
Free 1,000 $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing provides two months free. You can also control viewport and device presets, retina scale, lazy-loaded images, custom CSS and JavaScript, click and wait actions, headers, cookies, user agent, timezone, geolocation, resource blocking, transparent backgrounds, resizing, cache TTL, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and PDF settings.

Start with 1,000 free screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

Ext.get returns null

Confirm the ID spelling and that the element is rendered. Remove a mistaken # prefix, and move the lookup into Ext.onReady or the component’s post-render listener.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

A selector finds the wrong element

Scope it to a known root, such as Ext.get('panelBody').query('div.card'), and use a component-specific class or data attribute instead of a generic class.

Ext.getDom produces no usable node

Pass the wrapper or the ID, not an arbitrary selector string, and verify that the element still exists. A destroyed component leaves previously saved references stale.

The canvas is blank or incomplete

Capture after the Ext view has rendered and after asynchronous content has arrived. Check whether the target is hidden, whether unsupported CSS is involved, and whether images or iframes come from another origin.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

toDataURL throws a security error

An image from another origin may have tainted the canvas. Serve the image with appropriate same-origin permissions or use a configured proxy; a cross-origin iframe cannot be read by client-side JavaScript.

The remote screenshot contains overlays

Use ScreenshotNeo’s cleanup options for consent banners, newsletter popups, and chat widgets, and disable individual cleanup steps when an overlay is part of the UI you intentionally need to document.

Performance and reliability considerations

  • Prefer an ID or a narrowly scoped selector over a document-wide query.
  • Capture after layout is stable; repeated captures during Ext layout work can produce inconsistent dimensions.
  • For html2canvas, large or image-heavy elements consume more browser memory. Capture only the required element instead of the entire page when possible.
  • Use a real browser screenshot when exact painting, cross-origin content, or iframe content matters more than keeping all processing in the page.
  • For remote jobs, inspect the response status and the X-Page-Verdict and X-Billed headers so your application can distinguish a clean capture from a failed or non-billable result.

Quick reference

// Ext wrapper by ID
var el = Ext.get('myDiv');

// Native HTMLElement
var node = Ext.getDom(el);

// First match under a root
var first = Ext.get('panelBody').selectNode('div.card');

// All native matches
var nodes = Ext.get('panelBody').query('div.card');

// All Ext wrappers
var elements = Ext.get('panelBody').query('div.card', false);

Use the Ext wrapper for Ext JS operations, convert it with Ext.getDom for browser APIs, and treat visual capture as a separate rendering task.

Frequently Asked Questions

Does Ext.get create a div if the ID is missing?

No. It only retrieves an existing matching node and returns null when none exists.

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

Can html2canvas capture an Ext JS component before it is rendered?

No. The component must have a rendered DOM representation; call the capture from a ready or post-render point.

Will a screenshot of a cross-origin iframe include the iframe’s contents?

Not with client-side html2canvas. Browser same-origin restrictions prevent the library from reading a cross-origin iframe.

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.