【问题标题】:Cypress upload file gives error Failed to execute 'atob' on 'Window'赛普拉斯上传文件给出错误无法在“窗口”上执行“atob”
【发布时间】:2020-09-15 14:14:47
【问题描述】:
    cy.fixture('invitati100.xls').as('logo')
        cy.get('[name="fileLista"]').then(function($input) {
          // convert the logo base64 string to a blob
          return Cypress.Blob.base64StringToBlob(this.logo, 'application/vnd.ms-excel')
            .then((blob) => {
              // pass the blob to the fileupload jQuery plugin
              // used in your application's code
              // which initiates a programmatic upload
              $input.fileupload('add', { files: blob })
            })
    })

给出错误:

cypress_runner. : 159529 InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded contains characters outside of the Latin1 range.
at http://platform/__cypress/runner/cypress_runner.js:1531:44
From previous event:
at Context.thenFn (http://platform/__cypress/runner/cypress_runner.js:69293:23)

我们使用 dojo 作为框架。 为什么会出现这个错误?

谢谢!

【问题讨论】:

    标签: cypress


    【解决方案1】:

    只要使用这个插件:

    https://www.npmjs.com/package/cypress-file-upload

    它超级简单而且有效!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-29
      • 1970-01-01
      • 2021-10-31
      • 1970-01-01
      • 2023-04-04
      • 2020-03-22
      • 2021-03-25
      • 2018-06-27
      相关资源
      最近更新 更多