Selenium docker : Firefox crashes when trying to open fancybox popup

标签 selenium docker selenium-webdriver selenium-grid selenium-firefoxdriver

我正在使用具有规范的 Selenium docker-compose:

ubuntu instance: 16.04
firefox browser version is 61.0
selenium version is 3.13.0
geckodriver version is 0.21.0.

我的docker-compose.yml文件如下:

version: "3"
services:
  selenium-hub:
    image: selenium/hub
    container_name: selenium-hub
    ports:
      - "4444:4444"
  chrome:
    image: selenium/node-chrome
    depends_on:
      - selenium-hub
    environment:
      - HUB_PORT_4444_TCP_ADDR=selenium-hub
      - HUB_PORT_4444_TCP_PORT=4444
  firefox:
    image: selenium/node-firefox
    depends_on:
      - selenium-hub
    environment:
      - HUB_PORT_4444_TCP_ADDR=selenium-hub
      - HUB_PORT_4444_TCP_PORT=4444

我正在运行一个带有按钮的测试,单击该按钮会打开一个弹出窗口。它不是警报或另一个窗口。问题是,当我尝试单击该按钮时,浏览器似乎崩溃了。但有以下异常(exception):

(/opt/firefox-latest/firefox:142): dconf-CRITICAL **: unable to create directory '/home/seluser/.cache/dconf': Permission denied.  dconf will not work properly.

[Parent 72, Gecko_IOThread] WARNING: pipe error (52): Connection reset by peer: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353

###!!! [Parent][MessageChannel] Error: (msgtype=0x16007F,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv

A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down
*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: telemetry_modules_ping

更多信息:

我试图通过 selenium-docker 访问的应用程序的 HTML 结构是:

 <a id=some_id href="javascript:void(0);" onclick="openPopup(true)" class="fancybox">
       <img src=some_src.svg class=some_class title>
</a>

我已经使用 xpath、class、css 选择器访问了元素。我无法查明问题的根本原因。是浏览器相关,还是docker相关,驱动相关?

更新: 我的 IDE 上的堆栈跟踪是:

org.openqa.selenium.SessionNotCreatedException: Tried to run command without establishing a connection
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:24:21.231Z'
System info: host: 'SOME_HOST', ip: 'SOME_IP', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_151'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 61.0.1, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 255, moz:profile: /tmp/rust_mozprofile.IYBVxi..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.4.0-1061-aws, rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, webdriver.remote.sessionid: 51c21208-100f-4a04-947c-3f9...}
Session ID: 51c21208-100f-4a04-947c-3f99316b75e7
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605)
    at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:448)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)  

最佳答案

已找到问题的解决方案。

我正试图找到一个明确的原因,但目前,自动化正在按预期工作。 我在 docker-compose.yml 中添加的几件事修复了如下问题: 在 selenium-hub 添加:

environment:
      - GRID_BROWSER_TIMEOUT=30

在火狐中添加:

volumes:
      - "/dev/shm:/dev/shm"

虽然它有效,但我仍然会寻找一个合乎逻辑的解释,如果有人知道,如果你把它贴在这里,我将不胜感激。

关于 Selenium docker : Firefox crashes when trying to open fancybox popup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51606091/

相关文章:

selenium - 从 CruiseControl.NET 执行命令行命令

java - WebDriver - 捕获的屏幕截图似乎具有红色或橙色色调

Docker - CPU限制配置

docker - Docker卷是分区还是子目录?

webdriver - 如果等待插槽空闲,Grid Hub http 客户端超时

selenium - Google Chrome 窗口大小调整限制

c# - Selenium 2 - 将焦点切换到没有名称/ID 的框架

python pandas重命名数据框

build - 文件; docker 构建卷 : changes to volume via ADD or COPY are not discarded

javascript - 在 Selenium WebDriverJS 中获取 WebElement 的 HTML 源代码