0

I have followed the instructions, but my script isn't working:

    # Wait for the iframe to be present
    print("a")
    result_frame = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID, '_tinymce-rwo3euny6y8_ifr'))
    )
    # Switch to the iframe
    print("b")
    driver.switch_to.frame(result_frame)
    # Wait for the body inside the iframe to be located
    print("c")
    mce_edit = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.XPATH, "//body[@id='tinymce']"))
    )
    # Send keys to the body element
    mce_edit.send_keys("Hello World")

And here the HTML element base on sequence:

<tinymce _ngcontent-krn-c55="" id="my-editor" placeholder="Be detailed and creative in your description to attract a buyer. Do not share your Discord, email, Skype, PayPal, or any other personal information as this violates our safety policy and will result in a suspension." class="ng-untouched ng-pristine ng-invalid">

  <textarea class="tinymce-selector" id="_tinymce-rwo3euny6y8" placeholder="Be detailed and creative in your description to attract a buyer. Do not share your Discord, email, Skype, PayPal, or any other personal information as this violates our safety policy and will result in a suspension." style="display: none;" aria-hidden="true"></textarea>
  
  <iframe id="_tinymce-rwo3euny6y8_ifr" frameborder="0" allowtransparency="true" title="Rich Text Area. Press ALT-0 for help." class="tox-edit-area__iframe"></iframe>
  
  
  <body id="tinymce" class="mce-content-body " data-id="_tinymce-rwo3euny6y8" contenteditable="true" spellcheck="false" style="overflow-y: hidden; padding-left: 15px; padding-right: 15px; min-height: 0px;" data-mce-style="overflow-y: hidden; padding-left: 15px; padding-right: 15px; min-height: 0px;" data-mce-placeholder="Be detailed and creative in your description to attract a buyer. Do not share your Discord, email, Skype, PayPal, or any other personal information as this violates our safety policy and will result in a suspension." aria-placeholder="Be detailed and creative in your description to attract a buyer. Do not share your Discord, email, Skype, PayPal, or any other personal information as this violates our safety policy and will result in a suspension." data-lt-tmp-id="lt-197197" data-gramm="false" xpath="1"><p><br data-mce-bogus="1"></p></body>
  


I have already tried several answer from stackoverflow but they didn't help. Any help would be appreciated.

Thanks!

3
  • Can you share the URL? It would work better in this case with IFRAMEs.
    – JeffC
    Commented Jan 1 at 21:20
  • Also, edit your question and post the full error message you are getting as text, properly formatted.
    – JeffC
    Commented Jan 1 at 21:21
  • What the error that you are getting?
    – Kovy Jacob
    Commented Jan 2 at 14:21

1 Answer 1

0

The issue with that element ID is that its not unique but dynamic. It will always change when the page is either refreshed or when you first navigate to it at a different time or day.

You need to pick a static attribute or text content from the element to be able to locate it reliably every time.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.