0

I am trying to interact with this iframe which is a Tinymce editor.

HTML code of the website can be seen in this image

When I try to locate the element using the following xpath

element1 = driver.find_element_by_xpath("//iframe[@id='assessment_questions_attributes_565794_text_ifr']")
driver.execute_script("arguments[0].click();", element1)
print("Element Clicked!")

I get a

NoSuchElementException

Previously I had no problems accessing Tinymce editors on the same website using the code below, more on this can be found here.

driver.execute_script("tinymce.get('{0}').focus()".format(id_of_element)
driver.execute_script("tinyMCE.activeEditor.setContent('{0}')".format("Hello World")

However in this case, it throws this exception

selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read property 'focus' of null

One more interesting thing, if I try to access the elements using Javascript, I get nothing.

document.getElementsByClassName("mce-content-body")

But when I manually change all the "hidden" attributes to "visible" and hidefocus to "0" in DOM the Javascript code works.

0 Answers0