ksaitoの日記

日々試したことの覚え書き

httpunitで同じ名前のフレームが取得できない

移転しました。

自動的にリダイレクトします。

httpunitで同じ名前のフレームが取得できない

httpunitでフレームを取得するには、WebConversationクラスのgetFrameContentsメソッドを使います。

WebConversation wc = new WebConversation;
WebRequest req = new GetMethodWebRequest("http://server/index.html" );
WebResponse res = wc.getResponse( req );
WebResponse fres = wc.getFrameContents("frame_name");

frameのname属性を指定してフレームを取得するが同じ名前のフレームが複数あると1つしか取り出せないようです。

<frameset rows="73,*" frameborder="0" border="0">
	<frame src="./top_menu.html" name="frame_name" border="0" scrolling="no" noresize>
	<frame src="./main.html" name="frame_name" border="0" noresize>
</frameset>

上記のような場合、2つのうち1つのフレームしか取り出せません。
httpunitのソースを見るとフレームはFrameHolderクラスでHashtableに保持されているため、同じ名前のフレームが複数あっての1つのフレームしか取り出せません。
http://httpunit.cvs.sourceforge.net/httpunit/httpunit/src/com/meterware/httpunit/FrameHolder.java?revision=1.15&view=markup&pathrev=httpunit_1_6_2

    /** Map from a frame selector to its corresponding web response. **/
    private Hashtable   _contents = new Hashtable();

maven2の始め方

mvn archetype:create -DgroupId=パッケージ名 -DartifactId=プロジェクト名

http://maven.apache.org/plugins/maven-archetype-plugin/


maven2リモートリポジトリ

http://www.ibiblio.org/maven2/