我正在测试一个被windows-1252编码的页面,它在html中有以下元标记:
<html>
<head>
<title>Meta-SSC</title>
<meta http-equiv="Content-Type" content="text/html">
<meta charset="windows-1252">但是柏树跑者抓不到它,也不能正确地显示这样的字符:

因为这个我的考试失败了。
另一方面,当在chrome ( 72.0.3626.121版正式构建32位运行在windows 10上)或firefox (65.0.2 64位)上测试它时,它工作正常:

你知道我怎么排除它吗?
在Cypress‘github找到了可能相关的本期。
发布于 2019-03-20 06:04:35
它确实是一个已知问题
这是我开发的解决方案:
Cypress.Commands.add('containsLike', {
prevSubject: true
}, (subject, search, chars) => {
chars = chars || 'áéíóúñÁÉÍÓÚÑ'
if (!Array.isArray(chars)) chars = chars.toString().split('')
chars.forEach( char => {
const repAllChars = new RegExp(char, 'g') // see: https://stackoverflow.com/a/17606289/47633
search = search.replace(repAllChars, '.')
})
const regExp = new RegExp('^' + search + '$')
return cy.wrap(subject).contains(regExp)
})我就是这样用的:
describe('my first test', () => {
it.only('should pass', () => {
cy.visit('http://localhost/xxxx/yyy.asp')
.get('div.flash_error span')
.containsLike('El código de la aplicacion no puede estar vacío.')
// it runs .contains(/^El c.digo de la aplicacion no puede estar vac.o\.$/)
})
})https://stackoverflow.com/questions/55203672
复制相似问题