We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would be great if it supports creating browsing context and tab from it as https://devdocs.io/puppeteer/ does.
try (ChromeDevToolsService parentDevToolService = ChromeServiceExt .createDevToolsService(chromeService.getVersion().getWebSocketDebuggerUrl())){}
public static ChromeDevToolsService createDevToolsService(String webSocketURL) { try { WebSocketService webSocketService = WebSocketServiceImpl.create(new URI(webSocketURL)); CommandInvocationHandler commandInvocationHandler = new CommandInvocationHandler(); Map<Method, Object> commandsCache = new ConcurrentHashMap<>(); ChromeDevToolsService devtools = (ChromeDevToolsService) 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); return devtools; }catch(Exception e) { throw new SnapshotGenerationException("Couldn't create ChromeDevToolsService for chrome webSocketDebuggerUrl ",e); } }
static ChromeTab createTab(ChromeService chromeService, ChromeDevToolsService parentDevToolService, String browserContext) { ChromeTab tab; String targetId = parentDevToolService.getTarget().createTarget(SnapshotGenConstants.ABOUT_BLANK, null, null,browserContext, null, null, null); tab = chromeService.getTabs().stream().filter(chromeTab -> chromeTab.getId().equals(targetId)) .findFirst().get(); return tab; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Would be great if it supports creating browsing context and tab from it as https://devdocs.io/puppeteer/ does.
try (ChromeDevToolsService parentDevToolService = ChromeServiceExt
.createDevToolsService(chromeService.getVersion().getWebSocketDebuggerUrl())){}
public static ChromeDevToolsService createDevToolsService(String webSocketURL) {
try {
WebSocketService webSocketService = WebSocketServiceImpl.create(new URI(webSocketURL));
CommandInvocationHandler commandInvocationHandler = new CommandInvocationHandler();
Map<Method, Object> commandsCache = new ConcurrentHashMap<>();
ChromeDevToolsService devtools =
(ChromeDevToolsService) 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);
return devtools;
}catch(Exception e) {
throw new SnapshotGenerationException("Couldn't create ChromeDevToolsService for chrome webSocketDebuggerUrl ",e);
}
}
The text was updated successfully, but these errors were encountered: