pa11y - pa11y-ci 找不到 HTML 元素
问题描述
我正在尝试测试我正在使用 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)
任何帮助将不胜感激,非常感谢。
(仅供参考,我可以毫无问题地运行此处列出的示例)
解决方案
推荐阅读
- javascript - 如何在 Angular 5+ 中将 JavaScript 附加到 div?
- html - iframe 作为 div 背景,内部可见内容且可点击
- c# - 为“FindElementByID”按 click() 后出现异常
- javascript - 以编程方式查找 Firestore Doc 的所有子集合 - 示例不起作用
- swift - Voice navigation not working after MSDKUI 2.1.1 Update when adding GuidanceManeuverMonitor
- reactjs - React - onClick 事件无法正常工作
- layout - 有没有好办法让flutter布局大段?
- django - 将参数传输到抽象模型的元子类
- mysql - 显示上次发布的结果
- wpf - 如何调试 WPF 中的布局性能问题?