0

How is it possible to send keys to an editable body in an iframe?

Page:

<iframe id="description_ifr" frameborder="0" allowtransparency="true" title="Rich Text Area..." src="javascript:&quot;&quot;" style="width: 100%; height: 200px; display: block;"><html><head>...</head><body id="tinymce" class="mce-content-body " data-id="description" contenteditable="true" spellcheck="false" style="min-height: 184px;"><br data-mce-bogus="1"></body></html></iframe>

Code I tried:

description = browser.find_element_by_id('tinymce')
description.click()
description.send_keys("Test")

Error:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="tinymce"]"}

1 Answer 1

2

You should switch to the iframe before sending text.

try,

browser.switch_to_frame(browser.find_element_by_id('description_ifr'))
description = browser.find_element_by_id('tinymce')
description.click()
description.send_keys("Test")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.