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.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

First identify which CKEditor version and editing mode the page uses. For CKEditor 4 classic, switch Selenium into the editor’s iframe and type into its editable body. For CKEditor 4 inline and CKEditor 5, locate the rendered contenteditable surface and send keys to it directly. A hidden or replaced <textarea> is usually not the visible typing target.

Identify the editor before choosing a locator

CKEditor does not have one universal Selenium target. Its rendered editing surface depends on the editor generation and configuration, so inspect the live page DOM rather than assuming the original form field is where keyboard input belongs.

Editor configuration What to look for Selenium context and target
CKEditor 4 classic An editor iframe, often with a class such as cke_wysiwyg_frame Switch into the iframe, then locate its editable body
CKEditor 4 inline An element with contenteditable="true"; no editing iframe Stay in the page document and type into that element
CKEditor 5 Usually a .ck-editor__editable element with contenteditable="true" Stay in the page document and type into the editable element; for deliberate model-level setup, the element can expose ckeditorInstance

These are useful patterns, not guarantees about every application’s markup. The application may customize IDs, classes, wrappers, or editor configuration. In browser developer tools, inspect the live DOM around the editor and confirm whether an iframe exists and which element actually has contenteditable="true".

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

Why finding a textarea can still fail

A page may retain a textarea for form integration while CKEditor renders a separate editing surface. The textarea may be hidden, replaced, or otherwise not the visible control that receives user input. Selenium can locate such a field successfully but still fail to type into it as expected. Locate the rendered iframe or contenteditable element instead, and test whether the application synchronizes editor data when the form is submitted or saved.

Locate and type into CKEditor 4 classic

In CKEditor 4 classic mode, the editing area is inside an iframe. Selenium begins in the top-level document; finding the frame is only the first step. Switch into it before looking for its body, then switch back out before interacting with the rest of the page.

  1. Wait for the editor iframe to appear, using a selector that matches the application’s rendered DOM.
  2. Switch to the iframe with the located frame element.
  3. Wait for the editable body inside that frame and send text to it.
  4. Switch to the default document before locating or using page controls outside the editor.

This Python example assumes driver is an initialized Selenium WebDriver session and that the page is already open. The selectors shown are common CKEditor 4 patterns; inspect and adapt them if the application uses different markup.

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

wait = WebDriverWait(driver, 10)
frame = wait.until(
    EC.presence_of_element_located(
        (By.CSS_SELECTOR, "iframe.cke_wysiwyg_frame")
    )
)
driver.switch_to.frame(frame)

body = wait.until(
    EC.presence_of_element_located(
        (By.CSS_SELECTOR, "body[contenteditable='true']")
    )
)
body.send_keys("Text entered by Selenium")

driver.switch_to.default_content()

The wait for the frame’s presence and the wait for its editable body check different things: the iframe can exist before its editing document is ready. If the frame selector is known and you want Selenium to wait for it and switch as part of the same condition, use frame_to_be_available_and_switch_to_it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wait.until(
    EC.frame_to_be_available_and_switch_to_it(
        (By.CSS_SELECTOR, "iframe.cke_wysiwyg_frame")
    )
)
body = wait.until(
    EC.presence_of_element_located(
        (By.CSS_SELECTOR, "body[contenteditable='true']")
    )
)
body.send_keys("Text entered by Selenium")
driver.switch_to.default_content()

Use the second form when its automatic context switch suits your test flow. If an assertion or later page interaction fails, check which frame Selenium is currently in; it must return to the default document before it can see top-level page elements.

Type into CKEditor 4 inline or CKEditor 5

CKEditor 4 inline

Inline editing does not create an iframe around the editing area. Locate the contenteditable element in the page document, wait until it can be clicked, focus it, and send the keys:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

editor = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable(
        (By.CSS_SELECTOR, "#editor1[contenteditable='true']")
    )
)
editor.click()
editor.send_keys("Text entered by Selenium")

Replace #editor1 with an ID or selector that matches the page. Prefer an application-owned ID or data attribute when available; a generic selector can match the wrong editable element if the page has multiple rich-text controls.

CKEditor 5: user-like typing

For normal keyboard-input coverage, find the editable root, focus it, and use send_keys(). A common selector is .ck-editor__editable; if the page contains multiple editors, narrow it to the intended instance. You can also target .ck-editor__editable_inline when that matches the rendered markup.

Free tools Windows power users keep installed

One-click scans. No signup required.

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.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

editor = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable(
        (By.CSS_SELECTOR, ".ck-editor__editable")
    )
)
editor.click()
editor.send_keys("Text entered by Selenium")

This exercises the editor through keyboard events, which is appropriate when the test is intended to behave like a user typing. Afterward, verify the result through the application’s own visible state or save path rather than relying only on the presence of text in a DOM node.

CKEditor 5: intentional model-data setup

Some tests need to initialize editor data rather than verify typing behavior. CKEditor 5 documents access to the instance through the editable DOM element’s ckeditorInstance property. Once the editor has initialized, setData() can set its data:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

editor = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located(
        (By.CSS_SELECTOR, ".ck-editor__editable")
    )
)
driver.execute_script(
    "arguments[0].ckeditorInstance.setData(arguments[1]);",
    editor,
    "<p>Text set through the CKEditor 5 model</p>",
)

Use this deliberately as an API-level data-setting step, not as a substitute for a keyboard interaction test. If the test is meant to cover the user journey, type with Selenium and exercise the real application save or change path. Confirm that application state is persisted as expected.

Make the locator and wait resilient

  • Choose a stable target. Prefer an application-owned ID or data attribute. If neither exists, use a CSS selector scoped to the relevant editor container rather than a broad locator that could select another editor.
  • Wait for readiness, not elapsed time. Use explicit waits for the iframe or editable surface. A fixed sleep can be unnecessarily slow on a fast page and still too short on a slow one.
  • Respect frame context. Selenium searches only the current browsing context. After switching to an iframe, locate the body there; before using top-level page controls, return with driver.switch_to.default_content().
  • Distinguish presence from usability. Presence confirms an element is in the DOM. For direct typing on an inline or CKEditor 5 surface, waiting for clickability and focusing the target can avoid acting before it is usable.
  • Check initialization and saves separately. An editor surface can be rendered before it is ready for interaction, and entered content may still require the application’s normal submit or save action.

Selenium supports switching to frames by a WebElement, frame name or ID, or index. A located WebElement is often a good choice when the page provides a stable selector; avoid relying on a frame index if the page structure can change.

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

Troubleshoot common failures

“No such element” for the iframe or editable surface

Likely cause: The selector does not match the rendered page, the editor has not initialized, or the assumed editor mode is wrong.

Fix: Inspect the live DOM. Confirm whether the editor is CKEditor 4 classic, CKEditor 4 inline, or CKEditor 5, then update the selector and wait on the actual iframe or editable element.

The iframe is found, but the body is not

Likely cause: Selenium has not switched into the iframe, the iframe document is still loading, or the body selector differs from the page’s markup.

Fix: Switch to the located frame (or use frame_to_be_available_and_switch_to_it), then wait for the editable body inside that context. Check the frame’s document in developer tools to confirm its editable element.

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

Typing raises an interaction error or has no visible effect

Likely cause: The target is hidden, not focused, disabled, or is the original textarea rather than the editor surface.

Fix: Target the visible editable body or contenteditable root, wait for it to be clickable where appropriate, click it, and then send keys. Do not treat a successfully located hidden textarea as proof that it is the typing target.

Later controls cannot be found after typing

Likely cause: Selenium remains in the CKEditor 4 iframe.

Fix: Call driver.switch_to.default_content() before locating a control in the top-level page.

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

The editor displays text but the form does not save it

Likely cause: The application’s save or submit flow has not run, or the test set data through a route that does not exercise the expected user events.

Fix: Trigger the application’s normal save or submit action and assert the saved result. If the purpose is to verify typing and event handling, use send_keys(); reserve CKEditor 5 setData() for tests that intentionally set model data.

The editor works but is increasingly difficult to maintain

CKEditor 4 reached end of life in June 2023 and no longer receives normal updates, feature work, bug fixes, or security patches. For a CKEditor 4 application, account for that support status in maintenance decisions and determine whether the application can move to CKEditor 5 or has a supported CKEditor 4 arrangement.

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

Or skip the browser setup

If your goal is a screenshot of the page rather than a Selenium typing test, ScreenshotNeo is a website screenshot API and MCP server for developers. A screenshot API does not replace Selenium when you need to type into an editor or test form behavior; it can capture the rendered page instead. One GET request returns an image or PDF. Here is the documented cURL pattern, targeting a page with CKEditor:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://example.com/editor 
  -o shot.webp

See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 shots. See ScreenshotNeo for the service details. Sign up for 1,000 free screenshots a month with no card.

Choose the right interaction for the test

  • Use a frame switch and keyboard input for CKEditor 4 classic user-entry tests.
  • Use the contenteditable root directly for CKEditor 4 inline and CKEditor 5 user-entry tests.
  • Use CKEditor 5 ckeditorInstance.setData() only when the test intentionally sets editor model data instead of simulating typing.
  • In every mode, locate the live rendered surface, wait for it, and verify the application’s actual save or submit behavior.

Frequently Asked Questions

Can I use Selenium’s frame index to access CKEditor 4 classic?

Yes. Selenium supports frame switching by index, but a stable frame element or name/ID is usually easier to maintain when the page structure changes.

Does CKEditor 5 always use the selector `.ck-editor__editable`?

That is a common selector, not a universal guarantee. Inspect the rendered page and scope the locator to the intended editor.

Should I use `clear()` on a CKEditor editable surface?

The relevant target and behavior depend on the editor mode and application markup. The examples use `send_keys()` for entry; if a test must replace existing content, verify the chosen clearing or selection behavior in that specific editor.

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

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.