我正在处理有五个CK编辑器的Web应用程序。 我知道如何为一个CK编辑器发送数据并且它工作正常但是对于多个编辑者我面临问题,因为有共同的类可以识别。有人可以帮帮我吗?
这就是我尝试过的 -
sectionLinks(driver, linkHiringWelcoming).click();
if (driver.findElements(btnEdit).size() != 0)
ClickEdit(driver, btnEdit).click();
driver.switchTo().frame(driver.findElement(editor1));
driver.findElement(body);
WebElement editable = driver.switchTo().activeElement();
editable.clear();
editable.sendKeys(" Hello");
driver.switchTo().defaultContent();
driver.switchTo().frame(driver.findElement(editor2));
driver.findElement(body);
WebElement editable1 = driver.switchTo().activeElement();
editable1.clear();
editable1.sendKeys("Hello world”).
driver.switchTo().defaultContent();
ClickSubmit(driver, btnSubmit).click();
这是编辑的源代码,对所有人来说都很常见:
<iframe class="cke_wysiwyg_frame cke_reset" frameborder="0" src="" style="width: 100%; height: 100%;" title="Rich Text Editor, ca2_HIRING_NewEmployeeWelcome1435917971" aria-describedby="cke_63" tabindex="0" allowtransparency="true">
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<body class="cke_editable cke_editable_themed cke_contents_ltr cke_show_borders" contenteditable="true" spellcheck="false">
</html>
</iframe>
以下是包含详细信息的代码:
<div id="cke_ca2_HIRING_NewEmployeeHiring1436250116" class="cke_2 cke cke_reset cke_chrome cke_editor_ca2_HIRING_NewEmployeeHiring1436250116 cke_ltr cke_browser_gecko" lang="en" aria-labelledby="cke_ca2_HIRING_NewEmployeeHiring1436250116_arialbl" role="application" dir="ltr">
<span id="cke_ca2_HIRING_NewEmployeeHiring1436250116_arialbl" class="cke_voice_label">Rich Text Editor, ca2_HIRING_NewEmployeeHiring1436250116</span>
<div class="cke_inner cke_reset" role="presentation">
<span id="cke_2_top" class="cke_top cke_reset_all" style="height: auto; -moz-user-select: none;" role="presentation">
<div id="cke_2_contents" class="cke_contents cke_reset" role="presentation" style="height: 200px;">
<span id="cke_117" class="cke_voice_label">Press ALT 0 for help</span>
<iframe class="cke_wysiwyg_frame cke_reset" frameborder="0" src="" style="width: 100%; height: 100%;" title="Rich Text Editor, ca2_HIRING_NewEmployeeHiring1436250116" aria-describedby="cke_117" tabindex="0" allowtransparency="true">
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<body class="cke_editable cke_editable_themed cke_contents_ltr cke_show_borders" contenteditable="true" spellcheck="false">
</html>
</iframe>
</div>