您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何在iframe中的Rich Text编辑器中使用SendKeys(webdriver)命令

如何在iframe中的Rich Text编辑器中使用SendKeys(webdriver)命令

有多种实现方法。这是您可能想要看看的文章

使用Selenium WebDriver测试所见即所得的编辑器

这种方法是您尝试过但没有奏效的方法。请务必设法让你的定位程序<iframe><body>正确。否则,我建议使用JavaScriptExecutor更稳定的解决方案。

设置innerHTML

WaitTool.waitForElementPresent(Browser.instance, By.className(“cke_wysiwyg_frame”), 10); WebElement iframe = Browser.instance.findElement(By.className(“cke_wysiwyg_frame”)); Browser.instance.switchTo().frame(iframe);

WebElement description = Browser.instance.findElement(By.cssSelector(“body”)); (JavascriptExecutor)Browser.instance.executeScript(“arguments[0].innerHTML = ‘

使用CKEditor的本机API

// no need to switch iframe (JavascriptExecutor)Browser.instance.executeScript(“CKEDITOR.instances.ckeditor.setData(‘

其他 2022/1/1 18:14:21 有593人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶