【发布时间】:2018-11-29 14:53:39
【问题描述】:
Docker环境:Docker Container, ubuntu:18.10, geckodriver-v0.23.0-linux64, selenium-3.14.1
在 Chrome 中,我没有为我的 Docker 容器分配足够的资源。将“--disable-dev-shm-usage”标志添加到 Chrome 解决了这个问题。由于它使用本地 /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% 知道它们是同一个问题。
编辑:删除了一个不相关的堆栈跟踪
【问题讨论】:
标签: selenium docker selenium-webdriver