Description
I am navigating to a JIRA site and attempting to create a JIRA using Selenium and C# and the following configuration:
Edge Browser version 133.0.3065.82
Microsoft Edge WebDriver version: 133.0.3065.59
Selenium.WebDriver: 4.24.0
Selenium.Support: 4.24.0
.NET 8.0 Desktop - Windows Forms Application
In the code I click the “Create” button on the JIRA site and a “Create Issue” form appears. This form has a “textarea” for entering the description. When I generate the EdgeDriver using EdgeOptions containing “--headless”, the webdriver is unable to “SendKeys” or perform a copy/paste (using OpenQA.Selenium.Interactions.Actions with CTL+C and CTL+V) into the textarea.
However, if executed when NOT IN HEADLESS MODE, there are no issues performing either a SendKeys() or the Copy/Paste when interacting with the textarea.
The textarea HTML looks like this:
<div id="description-wiki-edit" class="wiki-edit-content">
<textarea class="textarea long-field wiki-textfield long-field mentionable wiki-editor-initialised wiki-edit-wrapped" id="description" name="description" wrap="virtual" data-projectkey="CCRB" data-qe-no-aria-labelled-by="true" data-use-new-endpoint="true" resolved="" style="min-height: 174px; max-height: 369px;" data-editor-id="1740509257556-5"></textarea>
<div class="rte-container">
<rich-editor contenteditable="true" data-issue-key="null" data-content-present="true" tabindex="-1" resolved=""></rich-editor>
</div>
<div class="content-inner"></div>
<div class="phantom-caret" style="top: 7.99716px; height: 0px;"></div>
<nav class="aui-navgroup aui-navgroup-horizontal editor-toggle-tabs">
<div class="aui-navgroup-inner">
<div class="aui-navgroup-primary">
<ul class="aui-nav" resolved="">
<li data-mode="wysiwyg">
<button type="button" class="aui-button" aria-pressed="false" resolved="">Visual</button>
</li>
<li data-mode="source" class="aui-nav-selected">
<button type="button" class="aui-button" aria-pressed="true" resolved="">Text</button>
</li>
</ul>
</div>
</div>
</nav>
<span class="aui-label editor-toggle-tooltip"></span>
</div>
And is within a pop-up form containing the textarea is defined like:
<section id="create-issue-dialog" class="aui-dialog2 aui-layer jira-dialog2 jira-dialog-core aui-dialog2-large jira-dialog-open jira-dialog-content-ready" role="dialog" aria-labelledby="jira-dialog2__heading" style="z-index: 3000;" data-aui-focus="false" data-aui-blanketed="true" open="" tabindex="-1">
My code to find and interact with the webelement looks like this:
IWebElement iweDescriptionText = driver.FindElement(By.Id("description"));
iweDescriptionText.Clear();
iweDescriptionText.SendKeys(“some text I want to send to the description textarea.”);
The SendKeys() command completes without issue but the text is not written to the text-area. If I attempt to access the Text property of the IWebElement afterwards it is an empty string.
Debug.WriteLine($"Set Description: "{iweDescriptionText.Text}"");
Again, this only fails when using the “--headless" EdgeOptions for WebDriver instantiation.