google-chrome - 无法调整在 Chrome 无头上运行 TestCafe 的窗口大小
问题描述
尝试在测试中使用 .resizeWindow 时出现错误,但仅当我针对无头模式运行测试时它才会失败。声明为警告的错误如下:
Warnings (1):
--
Was unable to resize the window due to an error.
Cannot read property 'Emulation' of undefined
我正在运行我的测试:
- HeadlessChrome 70.0.3538 / Mac OS X 10.13.6
Testcafe version 0.20.4
resizeWindow 指令在我的 beforeEach 中设置如下:
.beforeEach(async t => {
await t.navigateTo(`${testDomain}${Var.url_listing_general}`)
.resizeWindow(1420, 750);
}
});
解决方案
您是否尝试过不beforeEach
部分调整大小,而是在第一行进行测试?
另外,也许这很愚蠢而且不重要,但是在您的代码示例中,您}
在末尾beforeEach
部分有额外的内容,这会导致问题吗?
推荐阅读
- powershell - 使用 Get-AzureRmAutomationModule cmdlet 检索模块时全局模块的模块版本不一致
- ios - 如何在 Swift 中更改按钮标题的颜色
- python - 如何安装安装一些 Python 包,调试日志输出?
- python - 在我的 shell 中,当我运行该脚本时,它显示错误,当我使用 ipdb 时,它在第 30 行显示错误 TimeoutException: TimeoutException()
- google-bigquery - BigQuery cacheHit 属性
- apache - websphere 和 apache 服务器代理和重写配置
- python - Python 在循环之前评估 ifs
- java - java lambda - 如何遍历可选列表/可选流
- windows - 在 .dll(运行时加载)和 .exe 之间共享静态库
- swagger - 如何为只有 1 个 post 端点的 API 编写招摇的 API 文档?