記一個在移動端調試 web 頁面的方法

1. 工具:Weinrehtml

2. 安裝:npm -g install weinre | npm install weinre -g --registry=https://registry.npm.taobao.orgweb

3. 獲取 ip:ifconfig(Linux / Mac) |  ipconfig(Windows)npm

      Mac:按住 「option」按鍵,再點擊屏幕右上角的 wifi 圖標,能夠看到 IP 地址工具

4. 啓動服務: weinre --boundHost ip(如  172.16.1.120) --httpPort 9090
url

5. 根據提示打開網頁(這裏是 http://172.16.1.120:9090)spa

 

 

網頁顯示以下:debug

 

6. 要調試的頁面中引入上述圖片中 Example 下的 script,這裏是 <script src="http://172.16.1.120:9090/target/target-script-min.js#anonymous"></script7. 點擊 Access Point 下的第一個連接(debug client user interface),這裏是 http://172.16.1.120:9090/client/#anonymous3d

網頁顯示以下:(此時尚未設備)調試

 

7. 在移動設備上打開要調試的 web 頁面,加載成功後開始調試:(默認選中最新打開 web 頁面)code

 

上面的 elements、network、console 等均可使用了。

相關文章
相關標籤/搜索