Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ pub fn parse_command(args: &[String], flags: &Flags) -> Result<Value, ParseError
nav_cmd["iosDevice"] = json!(device);
}
}
if let Some(ref wait_until) = flags.wait_until {
nav_cmd["waitUntil"] = json!(wait_until);
}
Ok(nav_cmd)
}
"back" => Ok(json!({ "id": id, "action": "back" })),
Expand Down
9 changes: 9 additions & 0 deletions cli/src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ pub struct Flags {
pub confirm_interactive: bool,
pub native: bool,
pub engine: Option<String>,
pub wait_until: Option<String>,

// Track which launch-time options were explicitly passed via CLI
// (as opposed to being set only via environment variables)
Expand Down Expand Up @@ -347,6 +348,7 @@ pub fn parse_flags(args: &[String]) -> Flags {
|| config.confirm_interactive.unwrap_or(false),
native: env_var_is_truthy("AGENT_BROWSER_NATIVE") || config.native.unwrap_or(false),
engine: env::var("AGENT_BROWSER_ENGINE").ok().or(config.engine),
wait_until: env::var("AGENT_BROWSER_WAIT_UNTIL").ok(),
cli_executable_path: false,
cli_extensions: false,
cli_profile: false,
Expand Down Expand Up @@ -424,6 +426,12 @@ pub fn parse_flags(args: &[String]) -> Flags {
i += 1;
}
}
"--wait-until" => {
if let Some(s) = args.get(i + 1) {
flags.wait_until = Some(s.clone());
i += 1;
}
}
"--profile" => {
if let Some(s) = args.get(i + 1) {
flags.profile = Some(s.clone());
Expand Down Expand Up @@ -640,6 +648,7 @@ pub fn clean_args(args: &[String]) -> Vec<String> {
"--confirm-actions",
"--config",
"--engine",
"--wait-until",
];

let mut i = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ async function handleNavigate(
}

await page.goto(command.url, {
waitUntil: command.waitUntil ?? 'load',
waitUntil: command.waitUntil ?? 'domcontentloaded',
});

return successResponse(command.id, {
Expand Down Expand Up @@ -2665,7 +2665,7 @@ async function handleDiffScreenshot(
async function handleDiffUrl(command: DiffUrlCommand, browser: BrowserManager): Promise<Response> {
const page = browser.getPage();

const waitUntil = command.waitUntil ?? 'load';
const waitUntil = command.waitUntil ?? 'domcontentloaded';
const snapshotOpts = {
selector: command.selector,
compact: command.compact,
Expand Down