標籤:
1 下載nodejs並解壓至 nodejsproject/
http://nodejs.org/download/
2 安裝weinre
./nodejsprojectbin/bin/npm install weinre #使用nodejs提供的npm 否則會出錯
3 啟動weinre
./nodejsproject/node_modules/weinre [someoption]
options:
--httpPort port to run the http server on default: 8080
--boundHost ip address to bind the server to default: localhost //建議修改為 -all- 監聽所有ip
--verbose print more diagnostics default: false
--debug print even more diagnostics default: false
--readTimeout seconds to wait for a client message default: 5
--deathTimeout seconds to wait to kill client default: 3*readTimeout
(手機和伺服器必須在同一網段,可以相互訪問)
4 調試
1 手機:訪問 weinre 伺服器, http://xx.xx.xx.xx:8080
2 手機:在頁面上找到 Target Bookmarklet, 複製下面的js代碼,類似下面的格式 地址後面的anonymous可以修改以方便區分不同手機
//javascript:(function(e){e.setAttribute("src","http://xx.xx.xx.xx:8080/target/target-script-min.js#anonymous");document.getElementsByTagName("body")[0].appendChild(e);})(document.createElement("script"));void(0);
可以將js代碼儲存到書籤
3 手機:開啟新的標籤頁,訪問要調試的網頁 www.aaa.com/1.html
4 手機:在www.aaa.com/1.html所在的標籤頁點擊我們儲存的書籤,可以將我們的代碼注入到當前頁面,
或者 直接粘貼js代碼到地址欄,斷行符號 注入代碼
5 pc端:訪問(wenkit核心的瀏覽器) http://xx.xx.xx.xx:8080
在access point下訪問 http://xx.xx.xx.xx:8080/client/#anonymous
6 pc端:在targets 和clients中分別選擇要調試的目標網頁和目標裝置,然後點擊上方的項目選擇調試的項目,操作類似firebug
使用weinre遠端偵錯網頁