@statewalker/webrun-devtools
Version:
DevTools Extension for the StateWalker WebRun framework
26 lines (24 loc) • 903 B
HTML
<html>
<body>
<img id="img" />
<script type="module">
import initDevTools from "https://unpkg.com/@statewalker/webrun-devtools@0.0.12";
(async () => {
const apiKey = prompt("Enter the API Key:");
const url = prompt("Enter the URL to capture:", "https://www.google.com");
const api = await initDevTools({ apiKey });
try {
const winOptions = { url, focused:true, width:1200, height:800 }
const win = await api.windows.create(winOptions);
await new Promise(resolve => setTimeout(resolve, 1000));
const imgUrl = await api.tabs.captureVisibleTab(win.id, { format: "png" });
document.querySelector("#img").src = imgUrl;
await api.windows.remove(win.id);
} finally {
await api.close();
}
})().catch(console.error);
</script>
</body>
</html>