You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(17) |
Aug
(18) |
Sep
(22) |
Oct
(16) |
Nov
(6) |
Dec
(11) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(11) |
Feb
(10) |
Mar
(34) |
Apr
(26) |
May
(6) |
Jun
(22) |
Jul
(14) |
Aug
(4) |
Sep
(47) |
Oct
(69) |
Nov
(23) |
Dec
(21) |
2005 |
Jan
(53) |
Feb
(33) |
Mar
(92) |
Apr
(65) |
May
(63) |
Jun
(57) |
Jul
(43) |
Aug
(132) |
Sep
(61) |
Oct
(75) |
Nov
(60) |
Dec
(130) |
2006 |
Jan
(74) |
Feb
(87) |
Mar
(101) |
Apr
(58) |
May
(54) |
Jun
(42) |
Jul
(31) |
Aug
(67) |
Sep
(61) |
Oct
(71) |
Nov
(28) |
Dec
(58) |
2007 |
Jan
(53) |
Feb
(50) |
Mar
(96) |
Apr
(66) |
May
(55) |
Jun
(130) |
Jul
(99) |
Aug
(115) |
Sep
(37) |
Oct
(78) |
Nov
(24) |
Dec
(70) |
2008 |
Jan
(94) |
Feb
(85) |
Mar
(197) |
Apr
(274) |
May
(119) |
Jun
(143) |
Jul
(193) |
Aug
(99) |
Sep
(160) |
Oct
(120) |
Nov
(178) |
Dec
(109) |
2009 |
Jan
(238) |
Feb
(169) |
Mar
(115) |
Apr
(109) |
May
(131) |
Jun
(167) |
Jul
(144) |
Aug
(193) |
Sep
(155) |
Oct
(154) |
Nov
(97) |
Dec
(127) |
2010 |
Jan
(108) |
Feb
(127) |
Mar
(176) |
Apr
(113) |
May
(130) |
Jun
(200) |
Jul
(115) |
Aug
(80) |
Sep
(92) |
Oct
(101) |
Nov
(124) |
Dec
(53) |
2011 |
Jan
(67) |
Feb
(144) |
Mar
(88) |
Apr
(60) |
May
(89) |
Jun
(54) |
Jul
(68) |
Aug
(81) |
Sep
(48) |
Oct
(40) |
Nov
(10) |
Dec
(20) |
2012 |
Jan
(21) |
Feb
(28) |
Mar
(17) |
Apr
(35) |
May
(41) |
Jun
(44) |
Jul
(68) |
Aug
(67) |
Sep
(89) |
Oct
(58) |
Nov
(47) |
Dec
(56) |
2013 |
Jan
(49) |
Feb
(28) |
Mar
(46) |
Apr
(31) |
May
(28) |
Jun
(37) |
Jul
(34) |
Aug
(52) |
Sep
(42) |
Oct
(108) |
Nov
(59) |
Dec
(56) |
2014 |
Jan
(41) |
Feb
(72) |
Mar
(46) |
Apr
(21) |
May
(19) |
Jun
(17) |
Jul
(15) |
Aug
(40) |
Sep
(11) |
Oct
(3) |
Nov
(5) |
Dec
(31) |
2015 |
Jan
(11) |
Feb
(12) |
Mar
(19) |
Apr
(19) |
May
(38) |
Jun
(54) |
Jul
(14) |
Aug
(42) |
Sep
(14) |
Oct
(16) |
Nov
(26) |
Dec
(14) |
2016 |
Jan
(3) |
Feb
(1) |
Mar
(24) |
Apr
(5) |
May
(15) |
Jun
(14) |
Jul
(33) |
Aug
(19) |
Sep
(8) |
Oct
(10) |
Nov
|
Dec
(2) |
2017 |
Jan
(16) |
Feb
(12) |
Mar
(23) |
Apr
(8) |
May
(11) |
Jun
(20) |
Jul
(21) |
Aug
(20) |
Sep
|
Oct
(6) |
Nov
(9) |
Dec
(2) |
2018 |
Jan
(7) |
Feb
(5) |
Mar
(6) |
Apr
(5) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
|
Dec
(4) |
2019 |
Jan
(2) |
Feb
(2) |
Mar
(3) |
Apr
(4) |
May
|
Jun
(4) |
Jul
(9) |
Aug
(2) |
Sep
|
Oct
(4) |
Nov
(1) |
Dec
(7) |
2020 |
Jan
(2) |
Feb
(6) |
Mar
(9) |
Apr
(1) |
May
(1) |
Jun
(15) |
Jul
(1) |
Aug
(1) |
Sep
(2) |
Oct
(6) |
Nov
(3) |
Dec
(5) |
2021 |
Jan
(3) |
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Mike B. <mb...@Ga...> - 2003-09-15 00:38:18
|
Pg wrote: > I'm trying to "simulate" a navigation over a Html page. So, if an > element in the page has an associated event (like onmouseover), I want > to run the Javascript code associated (if exists) with this event. > I tried using the Htmlpage.executeJavaScriptIfPossible method in this > way: > > Htmlpage.executeJavaScriptIfPossible( javascript_code, message, false, > null) > > Here is the code: > > ScriptResult sr = > page.executeJavaScriptIfPossible("document.Form1.Input1.value = > 'go!';", "error in go!", false, null); > > The problem is that the new page I obtained in the ScriptResult Object > returned by the the previous operation doesn't differ at all from the > original page, when I was expecting a different value in the > Form1.Input1.value attribute: 'go!'. This operation doesn´t throw any > exception, it just pass..... but there`s no differences!!. The page returned in the ScriptResult will only be different if a new page was loaded as a result of executing the javascript. In this case, no new page will be loaded so the same page should be returned. I don't see anything wrong with the code you have provided - I would have expected this to work. Can you provide a more complete sample? -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Pg <pg...@ad...> - 2003-09-13 16:33:31
|
Hi Community!. I`m trying to call a javascript function I'm trying to "simulate" a navigation over a Html page. So, if an = element in the page has an associated event (like onmouseover), I want = to run the Javascript code associated (if exists) with this event.=20 I tried using the Htmlpage.executeJavaScriptIfPossible method in this = way: Htmlpage.executeJavaScriptIfPossible( javascript_code, message, false, = null) =20 Here is the code: ScriptResult sr =3D = page.executeJavaScriptIfPossible("document.Form1.Input1.value =3D = 'go!';", "error in go!", false, null); The problem is that the new page I obtained in the ScriptResult Object = returned by the the previous operation doesn't differ at all from the = original page, when I was expecting a different value in the = Form1.Input1.value attribute: 'go!'. This operation doesn=B4t throw any = exception, it just pass..... but there`s no differences!!. What am I doing wrong?. Thanks. Pablo Gallo. |
From: Mike B. <mb...@Ga...> - 2003-09-10 14:01:58
|
th...@cy... wrote: > is it possible to easily configure the WebClient like the HttpClient in > commons-httpclient? I would like to configure the timeout through > htmlunit, because the tests sometimes hang because of waiting endlessly > for the next page. Not at present. I'm planning to expose the HttpClient object in the HttpWebConnection in response to the following feature request but haven't got around to it yet. http://sourceforge.net/tracker/index.php?func=detail&aid=773552&group_id=47038&atid=448269 -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: <th...@cy...> - 2003-09-10 13:45:33
|
Hi, is it possible to easily configure the WebClient like the HttpClient in commons-httpclient? I would like to configure the timeout through htmlunit, because the tests sometimes hang because of waiting endlessly for the next page. best regards Thomas Berlin |
From: Mike B. <mb...@Ga...> - 2003-09-10 13:45:27
|
Olivier Fourel wrote: > <HTML> > <HEAD><META HTTP-EQUIV="Refresh" Content="0; URL= > http://redirection.net/.....></HEAD> > </HTML> > I guess i need to manually redirect the WebClient but i don't find any > method as WebClient.Refresh() > > Does anyone has a solution ? Redirection by meta tag isn't implemented yet - refer to this feature request: http://sourceforge.net/tracker/index.php?func=detail&aid=772233&group_id=47038&atid=448269 The only workaround I can think of off the top of my head is to get the new url from the meta tag and explicitly load the second page yourself -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Olivier F. <oli...@ne...> - 2003-09-10 13:20:14
|
Hi, =20 when i request a page, i obtain another page that should be acting as a = redirection. =20 The source is =20 <HTML> <HEAD><META HTTP-EQUIV=3D"Refresh" Content=3D"0; URL=3D = http://redirection.net/.....></HEAD> </HTML> I guess i need to manually redirect the WebClient but i don't find any = method as WebClient.Refresh()=20 =20 Does anyone has a solution ? =20 Thanks, =20 Olivier =20 =20 =20 |
From: Mike B. <mb...@Ga...> - 2003-09-06 23:55:12
|
Ryan Lubke wrote: > Anyone there any known issues with document.forms[index]? Not that I recall. Please open a bug report for this - bugs just reported via email are too easily lost. -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Ryan L. <Rya...@Su...> - 2003-09-05 20:47:27
|
On Fri, 2003-09-05 at 14:40, Mike Bowler wrote: > Ryan Lubke wrote: > > ---------------------------------------------------------- > > EcmaError: lineNumber=[1] column=[0] > > lineSource=[document.forms[0].elements['worldMap_current'].value='NAmerica'; document.forms[0].submit()] name=[ConversionError] sourceName=[)] message=[The undefined value has no properties.] errorObject=[ConversionError: The undefined value has no properties.] > > --------------------------------------------------------- > > > > Anyone have any thoughts on this before I start digging deeper? > > I don't see anything obviously wrong with what you've posted. Can you > verify that elements['worldMap_current'] is returning a hidden field? Ok...I've got it narrowed down. It seems that if I issue page.executeJavaScriptIfPossible() with 'document.forms.length' the result is 0. So I changed the page to add a name attribute to the form and changed the javascript to: document.form1.worldMap_current.value='test' And it worked. Anyone there any known issues with document.forms[index]? -- Ryan Lubke <Rya...@Su...> Sun Microsystems, Inc. |
From: Ryan L. <Rya...@Su...> - 2003-09-05 19:46:53
|
On Fri, 2003-09-05 at 14:40, Mike Bowler wrote: > Ryan Lubke wrote: > > ---------------------------------------------------------- > > EcmaError: lineNumber=[1] column=[0] > > lineSource=[document.forms[0].elements['worldMap_current'].value='NAmerica'; document.forms[0].submit()] name=[ConversionError] sourceName=[)] message=[The undefined value has no properties.] errorObject=[ConversionError: The undefined value has no properties.] > > --------------------------------------------------------- > > > > Anyone have any thoughts on this before I start digging deeper? > > I don't see anything obviously wrong with what you've posted. Can you > verify that elements['worldMap_current'] is returning a hidden field? If you mean executing document.forms[0].elements['worldMap_current'] then yes...this by itself fails. The element is available when calling HtmlPage.getAllHtmlElements(); -- Ryan Lubke <Rya...@Su...> Sun Microsystems, Inc. |
From: Mike B. <mb...@Ga...> - 2003-09-05 18:37:19
|
Ryan Lubke wrote: > ---------------------------------------------------------- > EcmaError: lineNumber=[1] column=[0] > lineSource=[document.forms[0].elements['worldMap_current'].value='NAmerica'; document.forms[0].submit()] name=[ConversionError] sourceName=[)] message=[The undefined value has no properties.] errorObject=[ConversionError: The undefined value has no properties.] > --------------------------------------------------------- > > Anyone have any thoughts on this before I start digging deeper? I don't see anything obviously wrong with what you've posted. Can you verify that elements['worldMap_current'] is returning a hidden field? -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Ryan L. <Rya...@Su...> - 2003-09-05 18:07:50
|
Hello, I'm using HtmlUnit v, 1.2.3. I have a page that renders an image map with multiple 'live' areas. Here is an example of the AREA element: <area alt="NAmerica" coords=<SOME COORDS>" shape="poly" onmouseout="document.forms[0].mapImage.src='/images/world.gif'" onmouseover="document.forms[0].mapImage.src='/images/world_namer.gif'" onclick="document.forms[0].worldMap_current.value='NAmerica'; document.forms[0].submit()"> I'm trying to validate the worldMap_current hidden field is appropriately updated when the onClick handler is invoked, however when I call executeJavascriptIfPossible on the HtmlArea element, I receive the following: ---------------------------------------------------------- EcmaError: lineNumber=[1] column=[0] lineSource=[document.forms[0].elements['worldMap_current'].value='NAmerica'; document.forms[0].submit()] name=[ConversionError] sourceName=[)] message=[The undefined value has no properties.] errorObject=[ConversionError: The undefined value has no properties.] --------------------------------------------------------- Anyone have any thoughts on this before I start digging deeper? |
From: Mike B. <mb...@Ga...> - 2003-09-02 23:21:59
|
Gonzalo-Alvo, Andres wrote: > Hi there, > > It's there any way to click an image like in: > > <td><img src="images/hcright.gif" alt="Move Right" > onclick="moveSelectedOptions(availableRoles, roles)" /></td>? Sorry for the delay, between a busy work schedule and recent power failures and ISP problems, I'm way behind on just about everything. No, the HtmlImage class doesn't currently support mouse clicks. Please open a feature request for this. -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: <Gou...@ne...> - 2003-08-25 14:48:04
|
Following was in attachment for 'Re: [Htmlunit-user] Executing JavaScript 3' but was eaten by mailing list. This is a modified Window object that enables accessing frames by name. /* * Copyright (c) 2002, 2003 Gargoyle Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Gargoyle Software Inc. * (http://www.GargoyleSoftware.com/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * 4. The name "Gargoyle Software" must not be used to endorse or promote * products derived from this software without prior written permission. * For written permission, please contact in...@Ga.... * 5. Products derived from this software may not be called "HtmlUnit", nor may * "HtmlUnit" appear in their name, without prior written permission of * Gargoyle Software Inc. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.gargoylesoftware.htmlunit.javascript.host; import com.gargoylesoftware.htmlunit.AlertHandler; import com.gargoylesoftware.htmlunit.ConfirmHandler; import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.PromptHandler; import com.gargoylesoftware.htmlunit.SubmitMethod; import com.gargoylesoftware.htmlunit.TopLevelWindow; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.html.HtmlElement; import com.gargoylesoftware.htmlunit.html.HtmlFrame; import com.gargoylesoftware.htmlunit.html.HtmlInlineFrame; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Collections; import java.util.List; import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.Scriptable; //> HACK!!! import java.util.Hashtable; //< HACK!!! /** * A javascript window class * * @version $Revision: 1.22 $ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> * @author <a href="mailto:gou...@ne...">Alexei Goussev</a> */ public final class Window extends SimpleScriptable { private Document document_; private Navigator navigator_; private WebWindow webWindow_; private Screen screen_; private History history_; private Location location_; //> HACK!!! private Hashtable frames_ = new Hashtable(); //< HACK!!! /** * Create an instance. The rhino engine requires all host objects * to have a default constructor. */ public Window() { } /** * Javascript constructor. This must be declared in every javascript file because * the rhino engine won't walk up the hierarchy looking for constructors. */ public final void jsConstructor() { } /** * The javascript function "alert()" * @param message The message */ public void jsFunction_alert( final String message ) { final AlertHandler handler = getJavaScriptEngine().getWebClient().getAlertHandler(); if( handler == null ) { getLog().warn("window.alert(\""+message+"\") no alert handler installed"); } else { handler.handleAlert(document_.getHtmlPage(), message); } } /** * The javascript function "confirm()" * @param message The message * @return true if ok was pressed, false if cancel was pressed */ public boolean jsFunction_confirm( final String message ) { final ConfirmHandler handler = getJavaScriptEngine().getWebClient().getConfirmHandler(); if( handler == null ) { getLog().warn("window.confirm(\""+message+"\") no confirm handler installed"); return false; } else { return handler.handleConfirm(document_.getHtmlPage(), message); } } /** * The javascript function "prompt()" * @param message The message * @return true if ok was pressed, false if cancel was pressed */ public String jsFunction_prompt( final String message ) { final PromptHandler handler = getJavaScriptEngine().getWebClient().getPromptHandler(); if( handler == null ) { getLog().warn("window.prompt(\""+message+"\") no prompt handler installed"); return null; } else { return handler.handlePrompt(document_.getHtmlPage(), message); } } /** * Return the javascript property "document" * @return The document */ public Document jsGet_document() { return document_; } /** * Open a new window * * @param context The javascript Context * @param scriptable The object that the function was called on. * @param args The arguments passed to the function. * @param function The function object that was invoked. * @return The newly opened window */ public static Object jsFunction_open( final Context context, final Scriptable scriptable, final Object[] args, final Function function ) { final String url = getStringArg(0, args, null); final String windowName = getStringArg(1, args, ""); final String features = getStringArg(2, args, null); final boolean replaceCurrentEntryInBrowsingHistory = getBooleanArg(3, args, false); final Window thisWindow = (Window)scriptable; if( features != null || replaceCurrentEntryInBrowsingHistory == true ) { thisWindow.getLog().debug( "Window.open: features and replaceCurrentEntryInBrowsingHistory " + "not implemented: url=["+url + "] windowName=["+windowName + "] features=["+features + "] replaceCurrentEntry=["+replaceCurrentEntryInBrowsingHistory + "]"); } final URL newUrl = thisWindow.makeUrlForOpenWindow(url); final WebWindow newWebWindow= thisWindow.webWindow_.getWebClient().openWindow( newUrl, windowName, thisWindow.webWindow_ ); return (Window)newWebWindow.getScriptObject(); } private URL makeUrlForOpenWindow( final String urlString ) { if( urlString.length() == 0 ) { return null; } try { final Page page = webWindow_.getEnclosedPage(); if( page != null && page instanceof HtmlPage ) { return ((HtmlPage)page).getFullyQualifiedUrl(urlString); } else { return new URL(urlString); } } catch( final MalformedURLException e ) { getLog().error("Unable to create url for openWindow: relativeUrl=["+urlString+"]", e); return null; } } /** * Set a chunk of javascript to be invoked at some specified time later. * * @param context The javascript Context * @param scriptable The object that the function was called on. * @param args The arguments passed to the function. * @param function The function object that was invoked. * @return The newly opened window */ public static Object jsFunction_setTimeout( final Context context, final Scriptable scriptable, final Object[] args, final Function function ) { final String script = getStringArg(0, args, null); final int timeout = getIntArg(1, args, 0); final Runnable runnable = new Runnable() { public void run() { final Window window = (Window)scriptable; try { Thread.sleep(timeout); // Register this thread with the rhino engine Context.enter(); final HtmlPage htmlPage = window.document_.getHtmlPage(); htmlPage.executeJavaScriptIfPossible( script, "Window.setTimeout()", true, htmlPage); } catch( final Exception e ) { window.getLog().error("Caught exception in Window.setTimeout()", e); } finally { // Deregister this thread with the rhino engine Context.exit(); } } }; new Thread(runnable).start(); return null; } /** * Return the javascript property "navigator" * @return The document */ public Navigator jsGet_navigator() { return navigator_; } /** * Return the window property. This is a synonym for "self" * @return A reference to this */ public Window jsGet_window() { return this; } /** * Return the "self" property * @return this */ public Window jsGet_self() { return this; } /** * Return the location property * @return The location property */ public Location jsGet_location() { return location_; } /** * Set the location property. This will cause a reload of the window. * @param newLocation The url of the new content. */ public void jsSet_location( final String newLocation ) { try { final HtmlPage page = (HtmlPage)webWindow_.getEnclosedPage(); final URL url = page.getFullyQualifiedUrl(newLocation); webWindow_.getWebClient().getPage( webWindow_, url, SubmitMethod.GET, Collections.EMPTY_LIST ); } catch( final MalformedURLException e ) { getLog().error("jsSet_location(\""+newLocation+"\") Got MalformedURLException", e); } catch( final IOException e ) { getLog().error("jsSet_location(\""+newLocation+"\") Got IOException", e); } } /** * Return the "screen" property * @return the screen property */ public Screen jsGet_screen() { return screen_; } /** * Return the "history" property * @return the "history" property */ public History jsGet_history() { return history_; } /** * Initialize the object. * @param htmlPage The html page containing the javascript. * @exception Exception If an error occurs. */ public void initialize( final HtmlPage htmlPage ) throws Exception { webWindow_ = htmlPage.getEnclosingWindow(); webWindow_.setScriptObject(this); if( webWindow_ instanceof HtmlElement ) { setHtmlElement((HtmlElement)webWindow_); } document_ = (Document)makeJavaScriptObject("Document"); document_.setHtmlElement(htmlPage); final PropertyChangeListener listener = new PropertyChangeListener() { public void propertyChange( final PropertyChangeEvent event ) { if( event.getPropertyName().equals(htmlPage.PROPERTY_ELEMENT) ) { document_.initialize(); htmlPage.removePropertyChangeListener(this); } } }; htmlPage.addPropertyChangeListener(listener); navigator_ = (Navigator)makeJavaScriptObject("Navigator"); screen_ = (Screen)makeJavaScriptObject("Screen"); history_ = (History)makeJavaScriptObject("History"); location_ = (Location)makeJavaScriptObject("Location"); location_.initialize(this); //> HACK!!! if (htmlPage != null) { try { //here might happen some exception if there is something wrong with the frames. //preferred way is not to get in trouble with that exception here - it is better when it happens during frame is accessed by name. List frames = htmlPage.getFrames(); if (frames != null) { int i = 0; HtmlFrame frame = null; String frameName = null; for (i = 0; i < frames.size(); i++) { try { frame = (HtmlFrame)(frames.get(i)); frameName = frame.getName(); put(frameName, this, frame);//this should work, but does not cause //windows that contain frames never have HtmlElement! //This causes causes redirect to a superclass in //SimpleScriptable even if the property is set. frames_.put(frameName, frame);//this is a workaround for that seek behaviour } catch (Exception e) { //do nothing } } } } catch (Exception e) { //do nothing } } //< HACK!!! } //> HACK!!! public HtmlFrame getFrame(String frameName) { HtmlFrame toreturn = null; try { toreturn = (HtmlFrame)(frames_.get(frameName)); } catch (Exception e) { toreturn = null; } return toreturn; } //< HACK!!! //> HACK!!! /** * Return the specified property or NOT_FOUND if it could not be found. * @param name The name of the property * @param start The scriptable object that was originally queried for this property * @return The property. */ public Object get( final String name, final Scriptable start ) { boolean debug = false; //> DEBUG if (debug) System.out.println(/*TEMPORARY*/"Window.get called: " + name + "; " + start); if (debug) System.out.println(/*TEMPORARY*/"Window.get called on object " + this); //< DEBUG //> DEBUG if (debug) { if (start instanceof Window) { Window w = (Window)start; Object[] oa = w.getPropertyIds(this); System.out.println(/*TEMPORARY*/"Window.get (Window): property Ids length: " + oa.length); int i = 0; for (i = 0; i < oa.length; i++) { System.out.println(/*TEMPORARY*/"Window.get (Window): property Id: " + i + ": " + oa[i]); } } } //< DEBUG if (start instanceof com.gargoylesoftware.htmlunit.javascript.host.Window) { try { //> DEBUG if (debug) System.out.println(/*TEMPORARY*/"Window.get (HACK!!!) accessed"); //< DEBUG final com.gargoylesoftware.htmlunit.javascript.host.Window w = (com.gargoylesoftware.htmlunit.javascript.host.Window)start; //final Object result = w.getFrame(name); final com.gargoylesoftware.htmlunit.html.HtmlFrame frame = w.getFrame(name); if (frame != null) { final Object result = frame.getScriptObject(); if (result != null) { //> DEBUG if (debug) System.out.println(/*TEMPORARY*/"Window.get (HACK!!!): returns: " + result); //< DEBUG return result; } } else { //> DEBUG if (debug) System.out.println(/*TEMPORARY*/"Window.get (HACK!!!) skipped"); //< DEBUG } } catch (Exception e) { //> DEBUG if (debug) System.out.println(/*TEMPORARY*/"Window.get (HACK!!!) exception"); //< DEBUG } } return super.get(name, start); } //< HACK!!! /** * Return the value of the top property * @return The value of "top" */ public SimpleScriptable jsGet_top() { WebWindow window = webWindow_; while( window != null ) { if( window instanceof TopLevelWindow ) { return (SimpleScriptable)window.getScriptObject(); } window = ((HtmlElement)window).getPage().getEnclosingWindow(); } throw new IllegalStateException("Couldn't find a TopLevelWindow!"); } /** * Return the value of the parent property * @return the value of window.parent */ public SimpleScriptable jsGet_parent() { final SimpleScriptable parent; if( webWindow_ instanceof TopLevelWindow ) { parent = this; } else { final WebWindow parentWebWindow = ((HtmlElement)webWindow_).getPage().getEnclosingWindow(); parent = (SimpleScriptable)parentWebWindow.getScriptObject(); } return parent; } /** * Return the value of the opener property. * @return the value of window.opener */ public Object jsGet_opener() { if( webWindow_ instanceof TopLevelWindow ) { final WebWindow opener = ((TopLevelWindow)webWindow_).getOpener(); if( opener != null ) { return (Window)opener.getScriptObject(); } } return NOT_FOUND; } /** * Return the value of the frames property. Currently not implemented * @return The value of window.frames */ public SimpleScriptable[] jsGet_frames() { final Page page = webWindow_.getEnclosedPage(); if( page == null || page instanceof HtmlPage == false ) { return new SimpleScriptable[0]; } final HtmlPage htmlPage = (HtmlPage)page; final List frames = htmlPage.getFrames(); final int frameCount = frames.size(); final SimpleScriptable[] jsFrames = new SimpleScriptable[frameCount]; for( int i=0; i<frameCount; i++ ) { jsFrames[i] = (SimpleScriptable)((WebWindow)frames.get(i)).getScriptObject(); } return jsFrames; } /** * Return the WebWindow associated with this Window * @return The WebWindow */ public WebWindow getWebWindow() { return webWindow_; } /** * Set the focus to this element. */ public void jsFunction_focus() { getLog().debug( "Window.focus() not implemented" ); } /** * Remove focus from this element */ public void jsFunction_blur() { getLog().debug( "Window.blur() not implemented" ); } /** * Close this window */ public void jsFunction_close() { getLog().debug( "Window.close() not implemented" ); } /** * Return the value of the src attribute * @return the value of the src attribute. */ public String jsGet_src() { final WebWindow webWindow = getWebWindow(); if( webWindow instanceof HtmlInlineFrame ) { return ((HtmlInlineFrame)webWindow).getSrcAttribute(); } return ""; } /** * Set the value of the src attribute. In the case of an iframe, this will cause a reload of the page * @param newValue The new value */ public void jsSet_src( final String newValue ) { final WebWindow webWindow = getWebWindow(); if( webWindow instanceof HtmlInlineFrame ) { ((HtmlInlineFrame)webWindow).setSrcAttribute(newValue); } } /** * Set the value of the onload property. * @param newValue The new value */ public void jsSet_onload( final Object newValue ) { if( webWindow_.getEnclosedPage() instanceof HtmlPage ) { final HtmlPage page = (HtmlPage)webWindow_.getEnclosedPage(); if ( newValue instanceof Function ) { page.setOnLoadAttribute( newValue ); } else { getLog().error( "Invalid value set to window.onload. Value class: " + newValue.getClass () ); } } } /** * Return the value of the onload property. * @return the value of window.onload */ public Object jsGet_onload() { if( webWindow_.getEnclosedPage() instanceof HtmlPage ) { final HtmlPage page = (HtmlPage)webWindow_.getEnclosedPage(); return page.getOnLoadAttribute(); } return ""; } public String jsGet_name() { return webWindow_.getName(); } } __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 |
From: Mike B. <mb...@Ga...> - 2003-08-23 11:51:12
|
Johannes Trost wrote: > I suspect that HTMLUnit does not recognize a > page with content type "text/html" (which would > result in a HtmlPage object). Instead > I get a "text/plain", resulting in a TextPage object. > Has anybody observed a similar behaviour ? If the server is sending back a content type header of "text/html" then you will get an HtmlPage. If there is no content header then you might get the behaviour you are seeing. > Is there any "trick" to "cast" a TextPage to > a HtmlPage ? Once the page has been created you cannot change it from one kind to another. You can however provide your own PageCreator to customize the kind of page that is created for each content type. http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/WebClient.html#setPageCreator(com.gargoylesoftware.htmlunit.PageCreator) -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: <Gou...@ne...> - 2003-08-23 00:34:08
|
Hello all. Here are some more comments and news about javascript support. >2: WindowOpen does not work (at least when JavaScript tries to set focus to the newely opened window). window.open works perfect except it is called with url like 'about:blank' or empty string. This causes that window is not initialized than, and does not have a script object. This problem seems to affect also HtmlFrame objects: if one of the frames in the frameset is initialized with 'about:blank', the whole frameset fails to initialize. I'm afraid it will cost a lot of changes in htmlunit to fix it. >3: I have a following line in JavaScript: >parent.<frame_name>.location.href=<some_value>; >this would produce following method calls stack (all in package com.gargoylesoftware.htmlunit.javascript.host): >jsGet_parent in Window >a call to get a frame by name - fails >jsGet_location in Window >jsGet_href in Location > >All jsGet_XXX methods are doing right - I'm pretty sure. >I found out that the call to get frames is handled by >public Object get( final String name, final Scriptable start ) >method in com.gargoylesoftware.htmlunit.javascript.SimpleScriptable, and it would even return a requested frame, if it would be set as a property. >But it is not set: I have modified the get method to print out some debug infos and found out, that SimpleScriptable stores all declared JavaScript functions as properties, but does not contain properties for frames. > >I hope it is not much work to do something similar with frames as it is done with JavaScript functions. I would be obliged if someone would give me any idea what exactly should be done to fix it! In few words: I needed to access frames by name from JavaScript. Now I have a solution: it might not fit to the htmlunit API, but it works. I have modified the com.gargoylesoftware.htmlunit.javascript.host.Window object (see attachment) and marked all changes with >HACK ... <HACK. This IS a hack in this state, cause it might produce some unexpected results for example in case reserved properties names (like 'parent' or 'document') were used as frames names. I would be obliged if someone would review this code and give a feedback. Best regards Alexei Goussev __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 |
From: Johannes T. <joh...@im...> - 2003-08-22 04:24:08
|
Hi, for a research project I currently try to use HTMLUnit for the automated testing of a website with JSPs. I suspect that HTMLUnit does not recognize a page with content type "text/html" (which would result in a HtmlPage object). Instead I get a "text/plain", resulting in a TextPage object. Has anybody observed a similar behaviour ? Is there any "trick" to "cast" a TextPage to a HtmlPage ? I tried naivly calling the constructor of HtmlPage with parameter values extracted from the TextPage object. But this does not work. Thanks in advance. Johannes --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Dr. Johannes Trost email joh...@im... imbus AG WWW http://www.imbus.de Unter der Linde 16 phone +49 / (0)89 / 3219909-15 D-80939 M=FCnchen fax +49 / (0)89 / 3219909-50 Germany =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D |
From: Steve C. <st...@bl...> - 2003-08-18 17:26:55
|
>> I've succeeded in making a HtmlUnit test that logs into my web app. >> The response page is divided into 3 frames. How can I get the >> contents of a frame so I can verify them? I've tried calling various >> functions, but I can't find one that will return the contents: >> >> oFrame: HtmlFrame[<frame name="leftPane" noresize="" src=":leftPane">] >> oFrame.asText(): >> oFrame.asXml(): <frame name="leftPane" noresize="" src=":leftPane"/> >> oFrame.getChildElements(): [] >> webClient.getWebWindowByName("leftPane"): HtmlFrame[<frame >> name="leftPane" noresize="" src=":leftPane">] > > All the various frames are subclasses of WebWindow which has the > method getEnclosedPage(). Assuming that the page is html, it will > return an HtmlPage object which will have the content you are > looking for. > > Does this help? Yes, that was the clue I needed. I found that with code like HtmlPage filesPane = (HtmlPage) webClient.getWebWindowByName("files").getEnclosedPage(); I can get directly to the content of my frame (which is named "files"). Thanks, Steve |
From: <Gou...@ne...> - 2003-08-18 10:57:20
|
I was having the same problem using JUnits Swing UI with HtmlUnit, when 'reload classes ...' option was checked. It does not happen when you uncheck this option. It seems for me that JUnits class loader mixes up the classes, probably loading already loaded logging classes again. By the way, I was disturbed by 'info'-level messages about disabled redirects, so I'm running tests locally with java -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.defaultlog=warn junit.textui.TestRunner mytests.SmokeTests Regards Alexei Goussev __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 |
From: Mike B. <mb...@Ga...> - 2003-08-16 17:16:17
|
Steve Corwin wrote: > I've succeeded in making a HtmlUnit test that logs into my web app. > The response page is divided into 3 frames. How can I get the > contents of a frame so I can verify them? I've tried calling various > functions, but I > can't find one that will return the contents: > > oFrame: HtmlFrame[<frame name="leftPane" noresize="" src=":leftPane">] > oFrame.asText(): > oFrame.asXml(): <frame name="leftPane" noresize="" src=":leftPane"/> > oFrame.getChildElements(): [] > webClient.getWebWindowByName("leftPane"): HtmlFrame[<frame > name="leftPane" noresize="" src=":leftPane">] All the various frames are subclasses of WebWindow which has the method getEnclosedPage(). Assuming that the page is html, it will return an HtmlPage object which will have the content you are looking for. Does this help? -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Steve C. <st...@bl...> - 2003-08-14 18:17:42
|
I've succeeded in making a HtmlUnit test that logs into my web app. The response page is divided into 3 frames. How can I get the contents of a frame so I can verify them? I've tried calling various functions, but I can't find one that will return the contents: oFrame: HtmlFrame[<frame name="leftPane" noresize="" src=":leftPane">] oFrame.asText(): oFrame.asXml(): <frame name="leftPane" noresize="" src=":leftPane"/> oFrame.getChildElements(): [] webClient.getWebWindowByName("leftPane"): HtmlFrame[<frame name="leftPane" noresize="" src=":leftPane">] Thanks, Steve |
From: Mike B. <mb...@Ga...> - 2003-08-13 14:58:38
|
Caz Dolowicz wrote: > Exception caught in testProceedPage. Message: > org.apache.commons.logging.LogConfigurationException: > org.apache.commons.logging.LogConfigurationException: Class > org.apache.commons.logging.impl.Jdk14Logger does not implement Log > org.apache.commons.logging.LogConfigurationException: > org.apache.commons.logging.LogConfigurationException: > org.apache.commons.logging.LogConfigurationException: Class > org.apache.commons.logging.impl.Jdk14Logger does not implement Log I would suspect that there is an older version of commons-logging somewhere in the classpath. Try moving commons-logging.jar to the beginning of the classpath. -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Caz D. <ph...@1P...> - 2003-08-13 14:26:05
|
Hello, A friend recently referred me to HtmlUnit, and I'm very much looking forwar= d to using it. I downloaded HtmlUnit 1.2.3 because of the new getAllForms(= ) method. I created a very simple test case (pasted below), but I got the = logging error (also pasted below) when I tried to run it with JUnit. It ha= ppens when it reaches this line: wc =3D new WebClient(); (wc is previously defined as type WebClient). I replaced my commons-logging-1.0.2 jar with the newest release, 1.0.3, but= that didn't help, so I went back to 1.0.2. I used the JUnit integrated wi= th IDEA at work, and also standalone JUnit on my home computer (v3.8.1, as = I recall), but received the same error. I briefly poked around in the Html= Unit source code, but I didn't see anything sticking out. Any thoughts?=20= =20 Though I'm experienced in Java, I'm fairly new to automated unit testing. = So if this is not an HtmlUnit-related issue, please accept my apologies. Thanks. Brandan Stack Trace: C:\j2sdk1.4.1\bin\javaw.exe -classpath C:\IntelliJ-IDEA-3.0.4\lib\junit.jar= ;C:\Projects\HttpUnitDemo\WEB-INF\classes;C:\j2sdk1.4.1\jre\lib\charsets.ja= r;C:\j2sdk1.4.1\jre\lib\jaws.jar;C:\j2sdk1.4.1\jre\lib\jce.jar;C:\j2sdk1.4.= 1\jre\lib\jsse.jar;C:\j2sdk1.4.1\jre\lib\rt.jar;C:\j2sdk1.4.1\jre\lib\sunrs= asign.jar;C:\j2sdk1.4.1\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.1\jre\lib\ext\lda= psec.jar;C:\j2sdk1.4.1\jre\lib\ext\localedata.jar;C:\j2sdk1.4.1\jre\lib\ext= \sunjce_provider.jar;C:\j2sdkee1.3.1\lib\j2ee.jar;C:\JUnit\junit.jar;C:\cac= tus\lib\cactus-1.5-beta1.jar;C:\Projects\HttpUnitDemo\WEB-INF\lib\commons-h= ttpclient-2.0-beta2.jar;C:\Projects\HttpUnitDemo\WEB-INF\lib\htmlunit-1.2.3= .jar;C:\Projects\HttpUnitDemo\WEB-INF\lib\js-1.5R4.1.jar;C:\Projects\HttpUn= itDemo\WEB-INF\lib\nekohtml-0.7.7.jar;C:\Projects\HttpUnitDemo\WEB-INF\lib\= xercesImpl-2.4.0.jar;C:\Projects\HttpUnitDemo\WEB-INF\lib\xmlParserAPIs-2.2= .1.jar;C:\Projects\HttpUnitDemo\WEB-INF\lib\commons-logging.jar;C:\IntelliJ= -IDEA-3.0.4\lib\idea_rt.jar com.intellij.rt.execution.junit.ui.SwingTestRun= ner FirstHtmlUnitTester Exception caught in testProceedPage. Message: org.apache.commons.logging.L= ogConfigurationException: org.apache.commons.logging.LogConfigurationExcept= ion: Class org.apache.commons.logging.impl.Jdk14Logger does not implement L= og org.apache.commons.logging.LogConfigurationException: org.apache.commons.lo= gging.LogConfigurationException: org.apache.commons.logging.LogConfiguratio= nException: Class org.apache.commons.logging.impl.Jdk14Logger does not impl= ement Log at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryIm= pl.java:555) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryIm= pl.java:289) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryIm= pl.java:259) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390) at com.gargoylesoftware.htmlunit.ScriptEngine.<init>(ScriptEngine.java:53) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaSc= riptEngine.java:114) at com.gargoylesoftware.htmlunit.WebClient.createJavaScriptEngineIfPossibl= e(WebClient.java:159) at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:121) at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:106) at FirstHtmlUnitTester.testProceedPage(FirstHtmlUnitTester.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja= va:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso= rImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.swingui.TestRunner$16.run(TestRunner.java:623) Caused by: org.apache.commons.logging.LogConfigurationException: org.apache= .commons.logging.LogConfigurationException: Class org.apache.commons.loggin= g.impl.Jdk14Logger does not implement Log at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFac= toryImpl.java:420) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryIm= pl.java:548) ... 22 more Caused by: org.apache.commons.logging.LogConfigurationException: Class org.= apache.commons.logging.impl.Jdk14Logger does not implement Log at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFac= toryImpl.java:416) ... 23 more Process terminated with exit code 0 Sample Tester: import junit.framework.TestCase; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.WebClient; import java.net.URL; import java.net.MalformedURLException; import java.io.IOException; /** * * HTMLUnit Tester * * Test out HTMLUnit. * * * com.gargoylesoftware.htmlunit * com.gargoylesoftware.htmlunit.html * * Created by IntelliJ IDEA. * User: bjones * Date: Aug 11, 2003 * Time: 12:51:45 PM * To change this template use Options | File Templates. */ public class FirstHtmlUnitTester extends TestCase { private HtmlPage page =3D null; private WebClient wc =3D null; public void runTests() { testProceedPage(); } public void testProceedPage() { try { wc =3D new WebClient(); URL url =3D new URL("http://sourceforge.net/"); page =3D (HtmlPage) wc.getPage(url); System.out.println("Page title: " + page.getTitleText()); // System.out.println("Forms Length: " + page.getAllForms().siz= e()); assertEquals("SourceForge.net: Welcome", page.getTitleText().tr= im()); } catch (IOException e) { System.out.println("IOException caught in testProceedPage. Mes= sage: " + e.getMessage()); e.printStackTrace(); } } public static void main(String args[]) { FirstHtmlUnitTester fhut =3D new FirstHtmlUnitTester(); fhut.runTests(); =20=20=20=20=20=20=20=20 } } _____________________________________________________________ Sign up for FREE email from 1PhatCity at http://www.1PhatCity.com |
From: Mike B. <mb...@Ga...> - 2003-08-10 19:59:29
|
HtmlUnit-1.2.3 has been released. Full change log at http://htmlunit.sourceforge.net/changes-report.html -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: <Gou...@ne...> - 2003-08-08 11:32:03
|
Hello All! Im trying to write tests for a pretty reach WebApp using HtmlUnit and i found out that there are a lot of things missing for JavaScript support. Currently I'm trying to add them: some I could do, some not. The list of issues is here: 1: It is not possible to execute JavaScript function that takes href from an anchor, puts it as action of the form and submits the form than. This I could fix: there was one (or two) method missing in com.gargoylesoftware.htmlunit.javascript.host.Anchor I've added: import com.gargoylesoftware.htmlunit.html.HtmlAnchor; /** * Return the value of the href property. * @return The href property. */ public String jsGet_href() { return ((HtmlAnchor)getHtmlElementOrDie()).getHrefAttribute(); } /** * Set the href property. * Attention - this method was never tested! * @param href href attribute value. */ public void jsSet_href( final String href ) { //((HtmlAnchor)getHtmlElementOrDie()).setHrefAttribute(href); //method setHrefAttribute is missing in API - think of to add it! ((HtmlAnchor)getHtmlElementOrDie()).getElement() .setAttribute("href", href); //workaround for missing setHrefAttribute method //please check if it works } I did not neen jsSet_href method, so I didn't test it. It seems to be right and it compiles:) jsGet_href is working an makes JavaScript execute right. 2: WindowOpen does not work (at least when JavaScript tries to set focus to the newely opened window). I could not fix it, but I found out where the problem is: com.gargoylesoftware.htmlunit.javascript.host.Window public static Object jsFunction_open(...) executes perfect till the last line, where it tries to do following: return (Window)newWebWindow.getScriptObject(); newWebWindow is a valid Object, but its getScriptObject() method returns null. So nothing else can be executed on the object returned from jsFunction_open, even jsFunction_focus() that does nothing. I'm looking for a solution to set ScriptObject that is not null, that will be returned than by getScriptObject(). I guess something must create it ans than set it to the Window newWebWindow calling its setScriptObject() method. Any idea? 3: I have a following line in JavaScript: parent.<frame_name>.location.href=<some_value>; this would produce following method calls stack (all in package com.gargoylesoftware.htmlunit.javascript.host): jsGet_parent in Window a call to get a frame by name - fails jsGet_location in Window jsGet_href in Location All jsGet_XXX methods are doing right - I'm pretty sure. I found out that the call to get frames is handled by public Object get( final String name, final Scriptable start ) method in com.gargoylesoftware.htmlunit.javascript.SimpleScriptable, and it would even return a requested frame, if it would be set as a property. But it is not set: I have modified the get method to print out some debug infos and found out, that SimpleScriptable stores all declared JavaScript functions as properties, but does not contain properties for frames. I hope it is not much work to do something similar with frames as it is done with JavaScript functions. I would be obliged if someone would give me any idea what exactly should be done to fix it! Best regards Alexei Goussev __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 |
From: Mike B. <mb...@Ga...> - 2003-08-05 01:22:35
|
Brad Clarke wrote: > Found myself debugging the wrong code today so I added a snipit to > build.xml to generate a source jar file. I'm not sure if/how maven > could do this so I'll just post it here for now. I think "maven dist:build-src" will do what you want but I'll hang onto this diff just in case it doesn't ;-) -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |