Selenium Docker:尝试打开fancybox弹出窗口时Firefox崩溃

时间:2018-07-31 05:39:12

标签: 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

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

(/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上的stacktrace是:

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)  

1 个答案:

答案 0 :(得分:1)

找到了解决该问题的方法。

我正在尝试找到一个明确的原因,但是目前,自动化正在按预期进行。 我在docker-compose.yml中添加的几项内容解决了以下问题: 在selenium-hub中添加:

environment:
      - GRID_BROWSER_TIMEOUT=30

在firefox中添加:

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

尽管它可以正常工作,但我仍然会寻找一个合乎逻辑的解释,如果有人理解它,如果您将其发布在这里,将不胜感激。

相关问题