I am having a bit of a problem with Selenium. I am new to Selenium, web scraping and Python as a whole. I am doing a practice project where I can send emails straight from my IDE.
I have been able to enter things into the 'send to', 'cc', and 'subject lines' well. I am having a problem entering body text.
Here is a screenshot of my email/inspect element:
As you can see in this image (pixelized by Stack Overflow, but I think you can get the idea.) The body is one big box with the ID 'tinymce'. The code block representing this text input is:
<body
id="tinymce"
class="mce-content-body mce-inactive-editor"
data-id="ZmHtmlEditor1_body"
contenteditable="true"
style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); width: 696px; height: 212px;" data-mce-style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"
dir="LTR"
aria-label="Compose body">
<div><br data-mce-bogus="1"></div>
</body>
My code, to open the text box, is
# Email body text
content = pyit.inputStr(prompt='What is the body of your email?\n')
clickBodyText = browser.find_element_by_id('tinymce').click()
bodyText = browser.find_element_by_id('tinymce').sendKeys(content)
I click on the body text first to make the input active, and sendkeys of the content. This returns the no such element error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="tinymce"]"}
(Session info: chrome=84.0.4147.125)