下面的解决方案对我有用,直到 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 })
})
最佳答案
您使用的是什么版本的 CKEditor,您使用的是 javascript 框架吗?我们使用此命令在 Angular 应用程序中的 CKEditor 实例中输入文本并获得预期结果:
cy.get('parent-element')
.find('[contenteditable=true]')
.type('text')
也许它有帮助。
关于automation - 无法使用 Cypress 在 CK 编辑器中输入数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59718120/