如何修复'browser.takeScreenshot'代理错误?

时间:2019-03-25 16:35:31

标签: typescript protractor screenshot webdriver-manager

我在黄瓜量角器中进行了一些自动化测试,但突然从今天早上开始,'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>

更新:它在本地运行,仅当我在硒服务器上运行测试时,问题才会出现。

1 个答案:

答案 0 :(得分:0)

可能的原因

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

修复

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