我使用的是selenium 4-beta3 (但使用selenium 3.14时,我遇到了同样的错误)
接下来是驱动程序配置
Capybara.register_driver :remote do |app|
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:acceptInsecureCerts = true)
Capybara::Selenium::Driver.new(
app,
browser: :firefox,
url: "http://selenium-hub:4444/wd/hub",
capabilities: caps
)
endDocker-compose文件摘录:
version: '2'
services:
firefox:
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
# - TMPDIR=/home/seluser/
image: <via proxy from SeleniumHQ/docker-selenium/node-firefox:4.0.0-beta-3-20210426>
volumes:
- /dev/shm:/dev/shm
ports:
- 6902:5900
selenium-hub:
image: <via proxy from SeleniumHQ/docker-selenium/hub:4.0.0-beta-3-20210426 >
ports:
- 4442:4442
- 4443:4443
- 4444:4444无论何时我尝试运行test -它都失败了,firefox日志列出了这个错误:
{
"traceId": "896f73c51497bb215636151497801994",
"spanId": "f26ae935f64f5878",
"spanKind": "INTERNAL",
"eventTime": 1620655881163418737,
"eventName": "exception",
"attributes": {
"driver.url": "http://localhost:19528",
"exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: No space left on device (os error 28) at path \"/tmp/rust_mozprofiletz7oB7\"\nBuild info: version: '4.0.0-beta-3', revision: '5d108f9a67'\nSystem info: host: 'f8ad4b70c435', ip: '192.168.144.5', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.121-linuxkit', java.version: '1.8.0_282'\nDriver info: driver.version: unknown",
"exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: No space left on device (os error 28) at path \"/tmp/rust_mozprofiletz7oB7\"\nBuild info: version: '4.0.0-beta-3', revision: '5d108f9a67'\nSystem info: host: 'f8ad4b70c435', ip: '192.168.144.5', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.121-linuxkit', java.version: '1.8.0_282'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:128)\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:63)\n\tat org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:143)\n\tat org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:325)\n\tat org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:52)\n\tat org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:64)\n\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.grid.node.Node.execute(Node.java:240)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\n",
"exception.type": "org.openqa.selenium.SessionNotCreatedException",
"logger": "org.openqa.selenium.grid.node.config.DriverServiceSessionFactory",
"session.capabilities": "{\"browserName\": \"firefox\"}\n"
}
}当我检查火狐docker容器时,/tmp文件夹是空的。
EDIT:
我尝试指向/dev/shm作为tem并分配足够的内存
environment:
- TMPDIR=/dev/shm
shm_size: 4g它工作了-当查看日志时,我看到firefox webdriver初始化正确,但现在它在/home/seluser/目录中缺少空间
dconf-CRITICAL **: unable to create directory '/home/seluser/.cache/dconf': No space left on device. dconf will not work properly.
发布于 2021-05-11 02:45:31
已检查我的Docker桌面资源-磁盘映像大小空间不足。我增加了空间,测试开始工作了。
https://stackoverflow.com/questions/67472887
复制相似问题