Untitled
Anonymous
Plain Text
10/27/2025 11:47 AM
1.7 KB
13
Indexable
Never
using OpenQA.Selenium;
using OpenQA.Selenium.Support.PageObjects;
using OpenQA.Selenium.Support.UI;
using SeleniumExtras.WaitHelpers;
using System;
public class CMOTextSection
{
private readonly IWebDriver driver;
private readonly WebDriverWait wait;
public CMOTextSection(IWebDriver driver)
{
this.driver = driver;
wait = new WebDriverWait(driver, TimeSpan.FromSeconds(15));
PageFactory.InitElements(driver, this);
}
[FindsBy(How = How.CssSelector, Using = "div.swh-cluu-controls-html-input-editor[contenteditable='true']")]
private IWebElement TaskDescriptionHereField;
[FindsBy(How = How.XPath, Using = "//div[normalize-space()='Vorwärts gerichtet']")]
private IWebElement TaskDescriptionHereElement;
public void SelectHereTaskDescription()
{
WaitForElement(TaskDescriptionHereField);
WaitForLoadingBoxBarToDisappear();
TaskDescriptionHereField.Click();
WaitForLoadingBoxBarToDisappear();
WaitForElement(TaskDescriptionHereElement);
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", TaskDescriptionHereElement);
TaskDescriptionHereElement.Click();
}
private void WaitForElement(IWebElement element)
{
wait.Until(d =>
{
try { return element.Displayed && element.Enabled; }
catch { return false; }
});
}
private void WaitForLoadingBoxBarToDisappear()
{
try
{
wait.Until(ExpectedConditions.InvisibilityOfElementLocated(
By.CssSelector(".loading, .spinner, .progress, .mat-progress-bar, .MuiBackdrop-root")));
}
catch { }
}
}Editor is loading...
Leave a Comment