Feature Requests item #2443356, was opened at 2008-12-17 16:18
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497985&aid=2443356&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: None
Status: Open
Priority: 5
Private: No
Submitted By: Josh Holtzman (jholtzman)
Assigned to: Nobody/Anonymous (nobody)
Summary: Passing an index to gotoFrame()
Initial Comment:
The application I am testing generates opaque names and IDs for iframes. To
test the links in the iframes without knowing their names or IDs ahead of time,
I need to be able to call gotoFrame(int indexOfFrame), where the first iframe
is index 0, etc.
Rather than adding to the API, I simply modified the implementation of
HtmlUnitTestingEngineImpl to include a search by index if the name and ID are
not found:
private WebWindow getFrame(String frameNameOrId) {
// First try ID
for (FrameWindow frame : getCurrentPage().getFrames()) {
if (frameNameOrId.equals(frame.getFrameElement().getId())) {
return frame;
}
}
// Now try with Name
for (FrameWindow frame : getCurrentPage().getFrames()) {
if (frameNameOrId.equals(frame.getName())) {
return frame;
}
}
// Now try with index
try {
return
getCurrentPage().getFrames().get(Integer.parseInt(frameNameOrId));
} catch (Exception e) {}
// Nothing was found.
return null;
}
Adding something like this, either via an explicit API (int rather than String)
or by adding this capability to the existing getFrame(String) method, could be
beneficial for others, too.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497985&aid=2443356&group_id=61302
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development