SendKeys to Rich Text editor Selenium? [closed]

I wonder if someone can help me out. I can't find a way to 'sendkeys' to a rich text editor (Description) on my app. The code is the following:

https://i.stack.imgur.com/sk6Xg.png


Waiting for additional information by the OP, this is what I think is wrong with your Java code. I noticed that you highlighted what you think is the rich-text box you are trying to send key strokes to. However, that is most likely NOT the element that contains the text. Below that, you will see there is an iframe. Unless you switch to the specific iframe, you won't be able to interact with it. Once simple way to switch to an iframe is:

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); // New convention for setting explicit waits in Selenium
WebDriverWait wait = new WebDriverWait(driver, 10); // Old convention equivalent to line above
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("WHATEVER"))); // You can also search by `By.xpath(...)` or some other acceptable criteria like CSS, name, etc.

Here the timeout duration is arbitrary. That might be much longer than what you need and it is not really that important for your issue. Play with the value until you find one that is better suited for your needs. Once you have successfully switched to the iframe, you should be able to send keystrokes to the element. One of the elements inside the <html> tag should be your target.

WebElement elementInsideIframe = driver.findElement(...);
elementInsideIframe.sendKeys("TEST 123ABC");

If you need to do anything else with the text area (like setting text to bold), I think the best way is to use JavaScript commands to that. This seems out of scope for this post. Lastly, once you are done setting the keys, YOU MUST SWITCH BACK TO PARENT FRAME!!! Failure to do this will cause Selenium code to fail to interact with components in the normal frame because it thinks it is still interacting with the iframe. The same goes with opening new tags and switching tags to interact with the contents there. For tags, you need so save Window handles and use those handles to switch back and forth. Again, out of scope for this discussion (but I want you to be aware of this since it seems you didn't know about iframes and how to switch to them).

driver.switchTo().parentFrame();

If you put these lines together and fill in the missing information to locate the iframe and text area for your application, it should work just fine. That is, considering that the rest of your code is correct (which we haven't seen yet).