MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / run_direct

Function run_direct

src/lib.rs:958–1322  ·  view source on GitHub ↗

Direct execution without daemon (fallback).

(cli: &Cli, ws_url: &str)

Source from the content-addressed store, hash-verified

956
957/// Direct execution without daemon (fallback).
958async fn run_direct(cli: &Cli, ws_url: &str) -> Result<result::CommandResult> {
959 let mut client = cdp::CdpClient::connect(ws_url).await?;
960
961 let is_browser = cli.is_browser_level();
962
963 if is_browser {
964 return match &cli.command {
965 Commands::ListPages => {
966 commands::pages::list_pages(&mut client, cli.output_format()).await
967 }
968 Commands::NewPage {
969 url,
970 viewport,
971 device_scale_factor,
972 mobile,
973 geolocation,
974 accuracy,
975 extra_headers,
976 } => {
977 let params = commands::emulation::EmulateParams {
978 viewport: viewport.clone(),
979 device_scale_factor: *device_scale_factor,
980 mobile: *mobile,
981 geolocation: geolocation.clone(),
982 accuracy: *accuracy,
983 clear_viewport: false,
984 clear_geolocation: false,
985 clear_all: false,
986 block_url: cli.block_url.clone(),
987 unblock_url: cli.unblock_url.clone(),
988 clear_blocks: false,
989 };
990 params.validate()?;
991
992 let params = if params.has_emulation() {
993 Some(params)
994 } else {
995 None
996 };
997 commands::pages::new_page(&mut client, url, params, extra_headers.as_deref()).await
998 }
999 Commands::SwLogs {
1000 duration,
1001 extension_id,
1002 } => {
1003 commands::sw_logs::collect_sw_logs(
1004 &mut client,
1005 *duration,
1006 extension_id.as_deref(),
1007 cli.output_format(),
1008 )
1009 .await
1010 }
1011 _ => unreachable!(),
1012 };
1013 }
1014
1015 let (target_id_arg, page_idx_arg) = match &cli.command {

Callers 1

run_direct_fallbackFunction · 0.85

Calls 15

list_pagesFunction · 0.85
new_pageFunction · 0.85
collect_sw_logsFunction · 0.85
close_pageFunction · 0.85
select_pageFunction · 0.85
emulateFunction · 0.85
navigateFunction · 0.85
take_screenshotFunction · 0.85
take_heapsnapshotFunction · 0.85
evaluateFunction · 0.85
clickFunction · 0.85
click_atFunction · 0.85

Tested by

no test coverage detected