diff --git a/src/commands/reload.ts b/src/commands/reload.ts new file mode 100644 index 0000000..a8fc8bd --- /dev/null +++ b/src/commands/reload.ts @@ -0,0 +1,9 @@ +import { connect } from "../lib/browser" +import type { Flags } from "../lib/flags" + +export const reload = async (args: string[], flags: Flags) => { + const { page, close } = await connect(flags.tab) + await page.reload({ waitUntil: "networkidle0", timeout: flags.timeout }) + console.log(page.url()) + await close() +} diff --git a/src/index.ts b/src/index.ts index a77b617..e26a170 100755 --- a/src/index.ts +++ b/src/index.ts @@ -19,8 +19,9 @@ import { audit } from "./commands/audit" import { tab } from "./commands/tab" import { logs } from "./commands/logs" import { record } from "./commands/record" +import { reload } from "./commands/reload" -const commands = { go, url, back, forward, shot, snap, text, click, type, fill, key, move, drag, scroll, js, wait, audit, tab, logs, record } +const commands = { go, url, back, forward, reload, shot, snap, text, click, type, fill, key, move, drag, scroll, js, wait, audit, tab, logs, record } const help = `mb — Browser CLI for Agents @@ -32,6 +33,7 @@ Navigation: url Print current URL back Go back forward Go forward + reload Reload page Observe: shot [file] Screenshot (default: ./shot.png)