Re: [問題] 如何取得html標籤中的值??

看板java作者時間19年前 (2006/10/11 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
加個 htmlunit 如何? 我忘了 httpunit 的使用方式了,htmlunit 倒是覺得蠻直覺的... 主要是檢視原始碼 -> 找出 id/name 的值 -> 叫 htmlunit 把那個 element 挖出來 -> 設定屬性值 / 進行操作 -> 然後換下一個頁面 -> 回到檢視原始碼後重新再來... 啊,還可以操作 alert / confirm 的視窗,尤其是 confirm 可以 透過寫 Listener 決定要不要按下 "確定" 鈕! ※ 引述《fungi8210.bbs@ptt.cc》之銘言: > httpunit 也很好用喔!! > http://httpunit.sourceforge.net/ > try it!!! > ※ 引述《feicsh.bbs@bbs.wretch.cc (飛)》之銘言: > : Pattern pattern = Pattern.compile("href=\"[^\"]*"); > : Matcher m = pattern.matcher(sb.toString()); > : while(m.find()) { > : String str = m.group(); > : str = str.replaceFirst("href=\"", ""); > : str = str.substring(0, str.length()-1); > : System.out.println(str); > : } > : Instead of regular expression, > : HTML parser might be the more appropriate and pretty solution. > : If you are interested, read this site http://htmlparser.sourceforge.net/ -- ※ Origin: SayYA 資訊站 <bbs.sayya.org> ◆ From: xyz.t-times.net
文章代碼(AID): #15Az_f00 (java)
文章代碼(AID): #15Az_f00 (java)