-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi @boris779 . did you try selenoid?
I created a POC and the devtools feature works fine!
here the code...
version: '3'
services:
selenoid:
network_mode: bridge
image: aerokube/selenoid:latest-release
volumes:
- "./config:/etc/selenoid"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./video:/opt/selenoid/video"
- "./config/logs:/opt/selenoid/logs"
#environment:
# - OVERRIDE_VIDEO_OUTPUT_DIR=/path/to/config/video
command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs"]
ports:
- "4444:4444"
selenoid-ui:
image: "aerokube/selenoid-ui"
network_mode: bridge
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
and the java code requesting the devtools
private void startDevToolsSerice(WebDriver driver) {
ChromeDevToolsService devtools;
// Init ChromeDevtools client
WebSocketService webSocketService;
try {
webSocketService = WebSocketServiceImpl.create(new URI(
String.format("ws://localhost:4444/devtools/%s/page", ((RemoteWebDriver) driver).getSessionId())));
CommandInvocationHandler commandInvocationHandler = new CommandInvocationHandler();
Map<Method, Object> commandsCache = new ConcurrentHashMap<>();
devtools = ProxyUtils.createProxyFromAbstract(ChromeDevToolsServiceImpl.class,
new Class[] { WebSocketService.class, ChromeDevToolsServiceConfiguration.class },
new Object[] { webSocketService, new ChromeDevToolsServiceConfiguration() },
(unused, method, args) -> commandsCache.computeIfAbsent(method, key -> {
Class<?> returnType = method.getReturnType();
return ProxyUtils.createProxy(returnType, commandInvocationHandler);
}));
commandInvocationHandler.setChromeDevToolsService(devtools);
System.out.println("started!");
// testPrintNetworkRequests(devtools);
testPrintPerformanceRequests(devtools);
devtools.close();
System.out.println("Finishes!");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
I hope it be useful. regards!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels