什么是Firefox Gecko,等同于Chrome的--disable-dev-shm-usage标志

时间:2018-11-29 14:53:39

标签: selenium docker selenium-webdriver

Docker环境:Docker容器,ubuntu:18.10,geckodriver-v0.23.0-linux64,selenium-3.14.1

在Chrome中,我没有足够的资源分配给Docker容器。在Chrome中添加“ --disable-dev-shm-usage”标志可解决此问题。由于它使用本地/ tmp而不是/ dev / shm,因此具有足够的空间。

现在,我需要为Geckodriver解决相同的问题。我找不到Geckodriver等效标志“ --disable-dev-shm-usage”的文档。

有人知道它是否等效和/或等于吗?欢迎有其他想法。

编辑:添加错误消息:

我正在截取一些非常大的网页上特定元素的屏幕截图。有时是200张图片。

My Warning: Could not create image for ".thumbnail_none > .item-label-href[rel="nofollow"][target="_blank"] > .video-label-box > .branding" because:
Message: Browsing context has been discarded

My Warning: Could not create image for".thumbnail_none > .item-label-href[rel="nofollow"][target="_blank"] > .video-label-box > .branding" because:
Message: [Exception... "Failure"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://marionette/content/browser.js :: get rect :: line 254"  data: no]

My Warning: Could not create image for".active___2c4EX > .content___1UWin > .duration___fewg4" because:
Message: Browsing context has been discarded

My Warning: Could not create image for".article___1MtWi:nth-child(2) > .teaseCard > .think-module.teaseCard__picture > .eyebrow___3eQZ6.ph4-m.pt4 > .vilynx_listened > span" because:
Message: Failed to decode response from marionette

My Warning: Could not create image for".article___1Fn4y:nth-child(1) > .content___2Wmo9.teaseCard > .think-module.teaseCard__picture > .eyebrow___3eQZ6.ph4-m.pt4 > .vilynx_listened > span" because:
Message: Tried to run command without establishing a connection

此后,每次寻找选择器以制作图像的函数都会重复执行以下所有消息:

My Warning: Could not create image for"div[observeid="tbl-observe-1"] > .item-label-href[rel="nofollow"][target="_blank"] > .trc-main-label.video-label-box > .branding" because:
Message: Tried to run command without establishing a connection

Warning: Could not create image for".videoCube_2_child > .item-label-href[rel="nofollow"][target="_blank"] > .trc-main-label.video-label-box > .branding" because:
Message: Tried to run command without establishing a connection

Warning: Could not create image for".videoCube_3_child > .item-label-href[rel="nofollow"][target="_blank"] > .trc-main-label.video-label-box > .branding" because:
Message: Tried to run command without establishing a connection

Chromedriver的其他回溯可以在我遇到的另一个未解决的问题中找到:Why would using Selenium webdriver to execute JS fine locally on my Mac, but not in a Docker container?

添加“ --disable-dev-shm-usage”确实解决了Chomedriver的问题,但是我想在自己回答之前获得Geckodriver的答案。如果您有答案,请随时回答。我会测试您的答案并将其标记为正确。

它们是独立的问题,因为我不100%知道它们是同一问题。

编辑:删除了一个不相关的堆栈跟踪

2 个答案:

答案 0 :(得分:0)

尝试在带有标志-v /dev/shm:/dev/shm的docker run执行中使用卷

这应该适用于chrome和firefox执行,而功能中没有任何标志

Documentation

答案 1 :(得分:0)