小编GHU*_*ABI的帖子

如何在 Cypress Automation 的 CKeditor (v4) 中添加/键入文本?或者在 Cypress Automation 中设置 Ckeditor 值的任何方法?

我在commands.js中使用这个方法

Cypress.Commands.add(
'iframeLoaded', { prevSubject: 'element' },
($iframe) => {
    const contentWindow = $iframe.prop('contentWindow')
    return new Promise(resolve => {
        if (
            contentWindow &&
            contentWindow.document.readyState === 'complete'
        ) {
            resolve(contentWindow)
        } else {
            $iframe.on('load', () => {
                resolve(contentWindow)
            })
        }
    })
})
Cypress.Commands.add(
'getInDocument', { prevSubject: 'document' },
(document, selector) => Cypress.$(selector, document))
Run Code Online (Sandbox Code Playgroud)

我需要您的建议或任何其他方法来解决这个问题。

以下代码工作正常,但没有显示任何输出。

cy.get('iframe')
        .iframeLoaded()
        .its('document')
        .get('#cke_10_contents > .cke_wysiwyg_frame')
        .type("Text");
Run Code Online (Sandbox Code Playgroud)

这是我的脚本并在控制台中显示“超时重试:预期”等于“一些新文本”。

describe('demo', function() {
it('test', function() {


    cy.visit('https://automationtestname688296/create')
    cy.get('#email').type('test@email.com');
    cy.get('#password').type('test2020');
    cy.get('.checkmark').click().wait(2000);

    cy.get(':nth-child(6) > .form-control').contains('Login').click()
// I want to Enter …
Run Code Online (Sandbox Code Playgroud)

javascript automation ckeditor4.x cypress

4
推荐指数
1
解决办法
3064
查看次数

标签 统计

automation ×1

ckeditor4.x ×1

cypress ×1

javascript ×1