0

I have been working on using Zalenium for running our capybara tests against.

The tests run, but I am unable to upload images for testing image uploads.

I have mounted the folder with the images in the Zalenium containers and I have checked that the images are there, but I get a file not found error when using the file path to the images within the containers.

Zalenium config:

    docker run --rm -ti --name zalenium -p 4444:4444 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /tmp/videos:/home/seluser/videos \
  -v desktop/testdata/:/tmp/node/home/seluser/data \
  --privileged dosel/zalenium start \
  --desiredContainers 4 \
  --maxDockerSeleniumContainers 8

Browser config:

  when :chromeGrid
Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.new(app, :browser => :remote, url: "http://localhost:4444/wd/hub", desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome)
end
4

2 回答 2

1

您在测试中使用的路径是什么?

我假设测试的图像放置在主机上desktop/testdata/。但是测试应该在 中查找它们/home/seluser/data,因为它是容器中可用的文件夹。

于 2018-02-03T09:03:40.360 回答
0

当使用带有 Selenium 远程驱动程序的 Capybara 时,处理此问题的最简单方法是将图像保留在运行测试的机器上,file_detector在 selenium 中设置 a 并允许它自动将图像发送到运行远程浏览器的机器 - https:/ /github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb#L37 - https://github.com/SeleniumHQ/selenium/blob/master/rb/lib /selenium/webdriver/remote/oss/bridge.rb#L365

于 2018-02-02T17:29:34.177 回答