如何设置selenoid与docker compose



我正在尝试设置selenoid,使其在docker中运行,并使用docker compose。我试着按照指南https://aerokube.com/selenoid/1.6.0/#_selenoid_with_docker_compose并生成了一个docker-compose.yml文件,如下所示:

version: '3.6'
services:
selenoid:
image: aerokube/selenoid:latest-release
command: -conf /etc/selenoid/browsers.json -video-output-dir /opt/selenoid/video -log-output-dir /opt/selenoid/logs
network_mode: bridge
ports:
- 5656:4444
environment:
OVERRIDE_VIDEO_OUTPUT_DIR: /opt/selenoid/video
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./selenoid/video:/opt/selenoid/video
- ./selenoid/logs:/opt/selenoid/logs
- ./selenoid/browsers.json:/etc/selenoid/browsers.json:ro
selenoid-ui:
image: aerokube/selenoid-ui:latest-release
command: --selenoid-uri http://selenoid:4444
network_mode: bridge
ports:
- 5599:8080

browsers.json:

{
"chrome": {
"default": "91.0",
"versions": {
"91.0": {
"image": "selenoid/vnc_chrome:91.0",
"port": "4444"
}
}
}
}

但有了这种kotlin配置:

Configuration.remote = "http://localhost:5656/wd/hub"
Configuration.browserCapabilities = DesiredCapabilities().apply {
setCapability("browserName", "chrome")
setCapability("browserVersion", "91.0")
setCapability("enableVNC", true)
setCapability("selenoid:options", mapOf(
"enableVNC" to true,
"enableVideo" to true,
"name" to "Kotlin BrowserTest",
))
}

我在selenoid日志中得到了这些错误:

2021/06/04 16:32:29 [-] [NEW_REQUEST] [unknown] [172.17.0.1]
2021/06/04 16:32:29 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.17.0.1]
2021/06/04 16:32:29 [5] [LOCATING_SERVICE] [chrome] [91.0]
2021/06/04 16:32:29 [5] [USING_DOCKER] [chrome] [91.0]
2021/06/04 16:32:29 [5] [CREATING_CONTAINER] [selenoid/vnc_chrome:91.0]
2021/06/04 16:32:29 [5] [STARTING_CONTAINER] [selenoid/vnc_chrome:91.0] [1eefaee9142bc58215382caaf39a87cf7ce0a25ab64dd432241074262ef6325d]
2021/06/04 16:32:29 [5] [CONTAINER_STARTED] [selenoid/vnc_chrome:91.0] [1eefaee9142bc58215382caaf39a87cf7ce0a25ab64dd432241074262ef6325d] [0.34s]
2021/06/04 16:32:29 [5] [CREATING_VIDEO_CONTAINER] [selenoid/video-recorder:latest-release]
2021/06/04 16:32:29 [5] [STARTING_VIDEO_CONTAINER] [selenoid/video-recorder:latest-release] [cd11f627cf455453547e76bae90d9bb337d631d370c86eff4e6aaddff4e69181]
2021/06/04 16:32:29 [5] [VIDEO_CONTAINER_STARTED] [selenoid/video-recorder:latest-release] [cd11f627cf455453547e76bae90d9bb337d631d370c86eff4e6aaddff4e69181] [0.29s]
2021/06/04 16:32:29 [5] [SERVICE_STARTED] [selenoid/vnc_chrome:91.0] [1eefaee9142bc58215382caaf39a87cf7ce0a25ab64dd432241074262ef6325d] [0.10s]
2021/06/04 16:32:29 [5] [PROXY_TO] [1eefaee9142bc58215382caaf39a87cf7ce0a25ab64dd432241074262ef6325d] [http://172.17.0.4:4444]
2021/06/04 16:32:29 [5] [SESSION_ATTEMPTED] [http://172.17.0.4:4444] [1]
2021/06/04 16:32:30 [5] [SESSION_CREATED] [412ed8c80871bde7c90cfd1fec72c616] [1] [1.03s]
2021/06/04 16:32:30 [9] [SESSION_DELETED] [412ed8c80871bde7c90cfd1fec72c616]
2021/06/04 16:32:30 [5] [STOPPING_VIDEO_CONTAINER] [cd11f627cf455453547e76bae90d9bb337d631d370c86eff4e6aaddff4e69181]
2021/06/04 16:32:31 [5] [REMOVING_CONTAINER] [cd11f627cf455453547e76bae90d9bb337d631d370c86eff4e6aaddff4e69181]
2021/06/04 16:32:31 [5] [FAILED_TO_REMOVE_CONTAINER] [cd11f627cf455453547e76bae90d9bb337d631d370c86eff4e6aaddff4e69181] [Error: No such container: cd11f627cf455453547e76bae90d9bb337d631d370c86eff4e6aaddff4e69181]
2021/06/04 16:32:31 [5] [REMOVING_CONTAINER] [1eefaee9142bc58215382caaf39a87cf7ce0a25ab64dd432241074262ef6325d]
2021/06/04 16:32:31 [5] [CONTAINER_REMOVED] [1eefaee9142bc58215382caaf39a87cf7ce0a25ab64dd432241074262ef6325d]
2021/06/04 16:32:31 [5] [VIDEO_ERROR] [Failed to rename /opt/selenoid/video/selenoid2217ce756f255ba8e693926caa899ca2.mp4 to /opt/selenoid/video/412ed8c80871bde7c90cfd1fec72c616.mp4: rename /opt/selenoid/video/selenoid2217ce756f255ba8e693926caa899ca2.mp4 /opt/selenoid/video/412ed8c80871bde7c90cfd1fec72c616.mp4: no such file or directory]

以及junit 中的这些日志

unknown error: net::ERR_CONNECTION_REFUSED
(Session info: chrome=91.0.4472.77)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'JOL-WORKSTATION', ip: '10.5.21.136', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.2'
selenide.remote: http://localhost:5656/wd/hub
Driver info: org.openqa.selenium.remote.RemoteWebDriver
selenide.url: http://localhost:3000
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 91.0.4472.77, chrome: {chromedriverVersion: 91.0.4472.19 (1bf021f248676..., userDataDir: /tmp/.com.google.Chrome.QFkx1l}, goog:chromeOptions: {debuggerAddress: localhost:37451}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
selenide.baseUrl: http://localhost:8080
Session ID: 412ed8c80871bde7c90cfd1fec72c616
org.openqa.selenium.WebDriverException: unknown error: net::ERR_CONNECTION_REFUSED
(Session info: chrome=91.0.4472.77)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'JOL-WORKSTATION', ip: '10.5.21.136', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.2'
selenide.remote: http://localhost:5656/wd/hub
Driver info: org.openqa.selenium.remote.RemoteWebDriver
selenide.url: http://localhost:3000
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 91.0.4472.77, chrome: {chromedriverVersion: 91.0.4472.19 (1bf021f248676..., userDataDir: /tmp/.com.google.Chrome.QFkx1l}, goog:chromeOptions: {debuggerAddress: localhost:37451}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
selenide.baseUrl: http://localhost:8080
Session ID: 412ed8c80871bde7c90cfd1fec72c616
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
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:552)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:277)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:857)
at com.codeborne.selenide.drivercommands.Navigator.lambda$navigateTo$0(Navigator.java:70)
at com.codeborne.selenide.logevents.SelenideLogger.run(SelenideLogger.java:139)
at com.codeborne.selenide.drivercommands.Navigator.navigateTo(Navigator.java:66)
at com.codeborne.selenide.drivercommands.Navigator.open(Navigator.java:30)
at com.codeborne.selenide.SelenideDriver.open(SelenideDriver.java:86)
at com.codeborne.selenide.Selenide.open(Selenide.java:49)
at com.apurebase.puredynamic.selenium.BrowserTest.beforeEach(BrowserTest.kt:49)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptLifecycleMethod(TimeoutExtension.java:126)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptBeforeEachMethod(TimeoutExtension.java:76)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeMethodInExtensionContext(ClassBasedTestDescriptor.java:490)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$synthesizeBeforeEachMethodAdapter$19(ClassBasedTestDescriptor.java:475)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachMethods$2(TestMethodTestDescriptor.java:167)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$5(TestMethodTestDescriptor.java:195)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:195)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachMethods(TestMethodTestDescriptor.java:164)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:127)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at com.sun.proxy.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:135)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:832)

OVERRIDE_VIDEO_OUTPUT_DIR变量应指向Selenoid容器之外的目录。您正在指定容器中的/opt/selenoid/video

在Kotlin配置中,尝试将localhost更改为系统的当前活动IPV4

相关内容

  • 没有找到相关文章

最新更新