首页 > 解决方案 > 如何修复“browser.takeScreenshot”代理错误?

问题描述

我在黄瓜量角器中进行了一些自动化测试,但是从今天早上开始,“browser.takeScreenshot”方法突然失败,并出现以下错误:

     WebDriverError: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
           <html><head>
           <title>502 Proxy Error</title>
           </head><body>
           <h1>Proxy Error</h1>
           <p>The proxy server received an invalid
           response from an upstream server.<br />
           The proxy server could not handle the request <em><a         
     href="/wd/hub/session/29068642-008c-4e84-9f12-           
     e2896a9c6b3e/screenshot">GET&nbsp;/wd/hub/session/29068642-008c-4e84- 
     9f12-e2896a9c6b3e/screenshot</a></em>.<p>
           Reason: <strong>Error reading from remote server</strong></p>                
     </p>
           </body></html>

更新:它在本地工作,只有当我在 selenium 服务器上运行测试时才会出现问题。

标签: typescriptprotractorscreenshotwebdriver-manager

解决方案


可能的原因

您的浏览器已更新,不再使用您的测试驱动程序版本使用的协议。

使固定

  • 更简单的选择:更新测试框架。
  • 更难的选择:回滚您正在测试的浏览器版本并将其固定。

推荐阅读