From: nikola <web...@ya...> - 2005-03-18 09:31:31
|
Hi, Thank you Marc for your answer, I am using HtmlUnit 1.4, your example is fine, I have also reproduced simple example and it works fine, the problem is that my online application is not working ... here is the real test, (part of it, because you will see on option select it crashes so it doesn't make sense to go further with it )... application is online so please check it out, because we are stuck with this java.lang.StackOverFlow error trace :-)... code: import java.net.URL; import junit.framework.*; import junit.extensions.TestSetup; import java.util.*; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput; import com.gargoylesoftware.htmlunit.html.HtmlSelect; import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; import com.gargoylesoftware.htmlunit.html.HtmlTextArea; import com.gargoylesoftware.htmlunit.html.HtmlTextInput; import com.gargoylesoftware.htmlunit.html.HtmlInlineFrame; import com.gargoylesoftware.htmlunit.html.HtmlAnchor; import com.gargoylesoftware.htmlunit.html.HtmlFrame; import com.gargoylesoftware.htmlunit.html.HtmlOption; import com.gargoylesoftware.htmlunit.BrowserVersion; public class TestSuche extends WebTestCase { public TestSuche(String name) { super(name); } public static void setUpSuite() { } public static void tearDownSuite() { } public static Test suite() { return new TestSuite(TestSuche.class); } public void testOnChange () throws Exception { final WebClient client = new WebClient(BrowserVersion.INTERNET_EXPLORER_6_0); final URL produkt_frame_url = new URL ("http://www.skw.at/skw/frame.html?url=/40.asp"); final HtmlPage produkt_page = (HtmlPage)client.getPage(produkt_frame_url); final HtmlFrame main_frame = (HtmlFrame)produkt_page.getHtmlElementById("main"); final HtmlPage main_page = (HtmlPage)main_frame.getEnclosedPage(); final HtmlForm form = (HtmlForm)main_page.getFormByName("frm"); final HtmlSelect select_1 = (HtmlSelect)form.getSelectsByName("pgruppe").get(0); final HtmlSelect select_2 = (HtmlSelect)form.getSelectsByName("pfamilie").get(0); final HtmlSelect select_3 = (HtmlSelect)form.getSelectsByName("norm").get(0); final HtmlOption option_1 = (HtmlOption)select_1.getOptionByValue("009"); //crash !!! select_1.setSelectedAttribute(option_1, true); } } __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ |