selenium.common.exceptions.WebDriverException:消息:转发新会话时出错Docker 内设置功能错误的 VM 清空池
selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Empty pool of VM for setup Capabilities error within Docker
我正在 运行 验收测试中,仅在我的系统中遇到以下错误,这在我的其他团队系统中运行良好。我在我的 docker 容器中使用了一个 selenium webdriver,它在我的 PC 上也运行良好,但不知道为什么突然开始抛出这些错误。
错误堆栈跟踪:
E selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless, --no-sandbox, --disable-dev-shm-usage], extensions: [], prefs: {intl.accept_languages: en}}, javascriptEnabled: true, version: }
E Stacktrace:
E at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:118)
E at org.openqa.grid.web.servlet.DriverServlet.process (DriverServlet.java:85)
E at org.openqa.grid.web.servlet.DriverServlet.doPost (DriverServlet.java:69)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:707)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:790)
E at org.seleniumhq.jetty9.servlet.ServletHolder.handle (ServletHolder.java:865)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle (ServletHandler.java:535)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:146)
E at org.seleniumhq.jetty9.security.SecurityHandler.handle (SecurityHandler.java:548)
E at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:257)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle (SessionHandler.java:1595)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:255)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle (ContextHandler.java:1340)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:203)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doScope (ServletHandler.java:473)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doScope (SessionHandler.java:1564)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:201)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope (ContextHandler.java:1242)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:144)
E at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
E at org.seleniumhq.jetty9.server.Server.handle (Server.java:503)
E at org.seleniumhq.jetty9.server.HttpChannel.handle (HttpChannel.java:364)
E at org.seleniumhq.jetty9.server.HttpConnection.onFillable (HttpConnection.java:260)
E at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded (AbstractConnection.java:305)
E at org.seleniumhq.jetty9.io.FillInterest.fillable (FillInterest.java:103)
E at org.seleniumhq.jetty9.io.ChannelEndPoint.run (ChannelEndPoint.java:118)
E at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.runTask (EatWhatYouKill.java:333)
E at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce (EatWhatYouKill.java:310)
E at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.tryProduce (EatWhatYouKill.java:168)
E at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run (EatWhatYouKill.java:126)
E at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run (ReservedThreadExecutor.java:366)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:765)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.run (QueuedThreadPool.java:683)
E at java.lang.Thread.run (Thread.java:748)
/usr/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
这个错误信息...
selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless, --no-sandbox, --disable-dev-shm-usage], extensions: [], prefs: {intl.accept_languages: en}}, javascriptEnabled: true, version: }
...意味着无法检测到 was unable to initiate/spawn a new Browsing Context i.e. google-chrome session and the version of the 可能是由于您正在使用的二进制文件版本之间 不兼容 。
解决方案
确保:
- Selenium 升级到当前版本 Version 4.1.2。
- Chrome驱动程序 已更新为当前 ChromeDriver v98.0 级别。
- Chrome 浏览器 更新为当前 chrome=98(根据 chromedriver=98.0.4758.48 release notes ).
参考资料
您可以在以下位置找到一些相关的详细讨论:
问题是 docker 没有正确获取 chrome,所以我只是在本地删除了图像(selenium hub 和节点 chrome),然后再次下载它就可以了!
docker rmi {imageId}
我正在 运行 验收测试中,仅在我的系统中遇到以下错误,这在我的其他团队系统中运行良好。我在我的 docker 容器中使用了一个 selenium webdriver,它在我的 PC 上也运行良好,但不知道为什么突然开始抛出这些错误。
错误堆栈跟踪:
E selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless, --no-sandbox, --disable-dev-shm-usage], extensions: [], prefs: {intl.accept_languages: en}}, javascriptEnabled: true, version: }
E Stacktrace:
E at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:118)
E at org.openqa.grid.web.servlet.DriverServlet.process (DriverServlet.java:85)
E at org.openqa.grid.web.servlet.DriverServlet.doPost (DriverServlet.java:69)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:707)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:790)
E at org.seleniumhq.jetty9.servlet.ServletHolder.handle (ServletHolder.java:865)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle (ServletHandler.java:535)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:146)
E at org.seleniumhq.jetty9.security.SecurityHandler.handle (SecurityHandler.java:548)
E at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:257)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle (SessionHandler.java:1595)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:255)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle (ContextHandler.java:1340)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:203)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doScope (ServletHandler.java:473)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doScope (SessionHandler.java:1564)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:201)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope (ContextHandler.java:1242)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:144)
E at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
E at org.seleniumhq.jetty9.server.Server.handle (Server.java:503)
E at org.seleniumhq.jetty9.server.HttpChannel.handle (HttpChannel.java:364)
E at org.seleniumhq.jetty9.server.HttpConnection.onFillable (HttpConnection.java:260)
E at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded (AbstractConnection.java:305)
E at org.seleniumhq.jetty9.io.FillInterest.fillable (FillInterest.java:103)
E at org.seleniumhq.jetty9.io.ChannelEndPoint.run (ChannelEndPoint.java:118)
E at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.runTask (EatWhatYouKill.java:333)
E at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce (EatWhatYouKill.java:310)
E at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.tryProduce (EatWhatYouKill.java:168)
E at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run (EatWhatYouKill.java:126)
E at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run (ReservedThreadExecutor.java:366)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:765)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.run (QueuedThreadPool.java:683)
E at java.lang.Thread.run (Thread.java:748)
/usr/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
这个错误信息...
selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless, --no-sandbox, --disable-dev-shm-usage], extensions: [], prefs: {intl.accept_languages: en}}, javascriptEnabled: true, version: }
...意味着无法检测到
解决方案
确保:
- Selenium 升级到当前版本 Version 4.1.2。
- Chrome驱动程序 已更新为当前 ChromeDriver v98.0 级别。
- Chrome 浏览器 更新为当前 chrome=98(根据 chromedriver=98.0.4758.48 release notes ).
参考资料
您可以在以下位置找到一些相关的详细讨论:
问题是 docker 没有正确获取 chrome,所以我只是在本地删除了图像(selenium hub 和节点 chrome),然后再次下载它就可以了!
docker rmi {imageId}