我正在尝试在夏天注释文本区域中添加文本,但是生成了一个异常我尝试了很多方法,比如web元素的相对和绝对xpath和类,但是没有人工作
Thread.sleep(3000);
driver.findElement(By.xpath("//div[contains(@class,'note-editable panel-body')]")).sendKeys("test");
/*
driver.findElement(By.xpath(".//*[@id='addTaskFrm']/div[2]/div/div/div/div[3]/div[3]")).sendKeys("test");
*/
/*
driver.findElement(By.xpath("html/body/div[96]/div/div/form/div[2]/div/div/div/div[3]/div[3]")).sendKeys("test");
*/
/*(WebDriverWait wait = new WebDriverWait(driver, 90);// 1 minute
wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("note-editable panel-body")));
driver.findElement(By.className("note-editable panel-body")).sendKeys("cancel");*/
夏季音符的HTML代码
<div class="modal-body">
<div class="row">
<div class="col-xs-12 m-t-md">
<input id="note-title" name="name" value="Cancel Task" type="hidden">
<textarea id="modal-quick-note" class="form-control modal-description-box" name="description" rows="5" placeholder="Description" style="display: none;"></textarea>
<div class="note-editor note-frame panel panel-default">
<div class="note-editing-area">
<div class="note-handle">
<div class="note-control-selection" style="display: none;">
<div class="note-control-selection-bg"></div>
<div class="note-control-holder note-control-nw"></div>
<div class="note-control-holder note-control-ne"></div>
<div class="note-control-holder note-control-sw"></div>
<div class="note-control-sizing note-control-se"></div>
<div class="note-control-selection-info"></div>
</div>
</div>
<textarea class="note-codable"></textarea>
<div style="position: absolute; left: -100000px; opacity: 0;" contenteditable="true"></div>
<div class="note-editable panel-body" style="height: 235px;" contenteditable="true">
<p>
<p>
线程“main”中的异常org.openqa.selenium.ElementNotVisibleException:元素不可见