HarmonyOS使用Devtools工具调试前端页面


前言

关于“使用Devtools工具调试前端页面”,鸿蒙官网有详细文档,这里自己记录一下我是如何参照文档实现的,按照官网文档行不通可以试一下


注:我是mac系统,devecostudio版本是5.0.3.502

一、打开模拟器及Web页面

打开鸿蒙模拟器,打开对应的Web页面

二、新建脚本

根据操作系统从官网复制脚本到本地,新建.sh脚本文件(比如命名为myscript.sh)。mac脚本内容如下,windows可去官网查最新脚本

#!/bin/bash

# Initial port number
INITIAL_PORT=9222
 
# Get the current port number, use initial port number if not set previously
CURRENT_PORT=${PORT:-$INITIAL_PORT}

# Get the list of all PIDs that match the condition
PID_LIST=$(hdc shell cat /proc/net/unix | grep webview_devtools_remote_ | awk -F '_' '{print $NF}')

if [ -z "$PID_LIST" ]; then
    echo "Failed to retrieve PID from the device"
    exit 1
fi

# Increment the port number
PORT=$CURRENT_PORT

# Forward ports for each a
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值