【问题标题】:Not able to enter data in CK Editor with Cypress无法使用 Cypress 在 CK 编辑器中输入数据
【发布时间】:2020-04-30 06:07:00
【问题描述】:

以下解决方案一直工作到 chrome 版本 70,现在 70+ 我收到错误 CypressError: Timed out retrying: Expected to find element: 'p:eq(0)', but never found it. Queried from element: <body.cke_editable.cke_editable_themed.cke_contents_ltr>

现在停止工作的解决方案:


.then(function ($iframe) {
 const $body = $iframe.contents().find('body')
    cy
    .wrap($body)
    .find('p:eq(0)').type( "test", { force: true })
})

【问题讨论】:

    标签: automation cypress


    【解决方案1】:

    您使用的是哪个版本的 CKEditor,您使用的是 javascript 框架吗?我们使用此命令在 Angular 应用程序中将文本输入到 CKEditor 实例中并获得预期结果:

    cy.get('parent-element')
    .find('[contenteditable=true]')
    .type('text')
    

    也许有帮助。

    【讨论】:

    • 感谢您的回复,版本:“4.5.5 for CK Editor。是的,我正在使用 cypress 和 javascript。
    • 适用于 Cypress 版本 3.4.1 和低于 70 版本的 chrome 浏览器,但不适用于以上版本。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-10
    相关资源
    最近更新 更多