Testcafe 测试失败,因为 "Failed to find a DNS-record for the resource" 使用 VPN,但没有 VPN 它可以工作

Testcafe test fails because "Failed to find a DNS-record for the resource" with VPN, but without VPN it works

当我通过 VPN 连接时测试失败但没有它工作正常。它执行对此 URL 的点击: https://www.google.com/search?q=let+me+google+that+for+you

我试过 --proxy-bypass 设置,但我想我做的不对,有没有关于它应该是什么样子的指导?

VPN 不应影响您的测试。从症状来看,您似乎在使用代理,而不是 VPN。如果是,则应使用 --proxy 选项指定代理服务器地址,如下所述 here

--proxy <host>

指定在您的本地网络中用于访问 Internet 的代理服务器。

testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com
testcafe chrome my-tests/**/*.js --proxy 172.0.10.10:8080

您还可以使用代理主机指定身份验证凭据。

testcafe chrome my-tests/**/*.js --proxy username:password@proxy.mycorp.com

至于--proxy-bypass选项,意义相反。您可以使用它来指定未代理的资源,例如,托管在本地网络中的资源。