Feature Requests item #1641433, was opened at 2007-01-22 22:59
Message generated for change (Settings changed) made by jevonwright
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497985&aid=1641433&group_id=61302

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Core API
>Group: Release 2.1
Status: Open
>Priority: 3
Private: No
Submitted By: Bernard de Terwangne (bdt_star)
>Assigned to: Jevon Wright (jevonwright)
Summary: Testing calls to javascript functions

Initial Comment:
Add a function to do a javascript function call. Retrieving the result of the 
call would be nice to have (ie for asserting its content or passing it to 
another call)

----------------------------------------------------------------------

Comment By: Bernard de Terwangne (bdt_star)
Date: 2007-02-15 21:49

Message:
Logged In: YES 
user_id=1623716
Originator: YES

Julien,

Just to bring some contribution I made a first trial of implementation of
this function. Not sure all is done the right way. Anyway, here it is (from
HtmlUnitDialog) :

    public Object executeJavascriptIfPossible(String sourceCode, String
elementId)
    {
       Page page = win.getEnclosedPage();
       if (page instanceof HtmlPage)
       {
         HtmlPage htmlPage = (HtmlPage) page;
         HtmlElement htmlElement = elementId == null ? null :
getElement(elementId);
         ScriptResult scriptResult =
htmlPage.executeJavaScriptIfPossible(sourceCode, "jsWebUnit", true,
htmlElement);
         Page newPage = scriptResult.getNewPage();
         if (null != newPage)
         {
            win.setEnclosedPage(newPage);
            form = null;
         }
         return scriptResult.getJavaScriptResult();
       }
       return null;
    }

Amicalement,

Bernard

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497985&aid=1641433&group_id=61302

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to