我正在尝试测试我正在使用pa11y的网站的登录体验的可访问性。我在下面的配置中使用了pa11y-ci,但似乎无法使其正常工作:
{
"urls": [
{
"url": "https://somewhere/home",
"actions": [
"set field #email to jondoe@somewhere.com",
"click element #passwordsignin",
"wait for url to be https://somewhere/password"
],
"timeout": 60000
}
]
}
它失败并出现以下错误:
Error: Failed action: no element matching selector "#email"
我可以看到ID为#email的输入在HTML中(基于代码并检查HTML)。我怀疑问题在于测试是在输入在DOM中呈现之前运行的(它是用React编写的单页应用程序)。我尝试将以下内容添加到操作中:
"wait for element #email to be added"
但是没有用。我收到以下错误:
Error: Evaluation failed: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self'".
at new Function (<anonymous>)
at waitForPredicatePageFunction (<anonymous>:2:21)
任何帮助将不胜感激,非常感谢。
(仅供参考,我可以运行here列出的示例,没有任何问题)