Here is the Selenium core code for the selectFrame method,

BrowserBot.prototype.selectFrame = function(target) {
    if (target.indexOf("index=") == 0) {
        target = target.substr(6);
        var frame = this.getCurrentWindow().frames[target];
        if (frame == null) {
            throw new SeleniumError("Not found: frames["+target+"]");
        }
        if (!frame.document) {
            throw new SeleniumError("frames["+target+"] is not a frame");
        }
        this.currentWindow = frame;
        this.isSubFrameSelected = true;
    }
    else if (target == "relative=up" || target == "relative=parent") {
        this.currentWindow = this.getCurrentWindow().parent;
        this.isSubFrameSelected =
(this._getFrameElement(this.currentWindow) != null);
    } else if (target == "relative=top") {
        this.currentWindow = this.topFrame;
        this.isSubFrameSelected = false;
    } else {
        var frame = this.findElement(target);
        if (frame == null) {
            throw new SeleniumError("Not found: " + target);
        }
        // now, did they give us a frame or a frame ELEMENT?
        var match = false;
        if (frame.contentWindow) {
            // this must be a frame element
            if (browserVersion.isHTA) {
                // stupid HTA bug; can't get in the front door
                target = frame.contentWindow.name;
            } else {
                this.currentWindow = frame.contentWindow;
                this.isSubFrameSelected = true;
                match = true;
            }
        } else if (frame.document && frame.location) {
            // must be an actual window frame
            this.currentWindow = frame;
            this.isSubFrameSelected = true;
            match = true;
        }

        if (!match) {
            // neither, let's loop through the frame names
            var win = this.getCurrentWindow();

            if (win && win.frames && win.frames.length) {
                for (var i = 0; i < win.frames.length; i++) {
                    if (win.frames[i].name == target) {
                        this.currentWindow = win.frames[i];
                        this.isSubFrameSelected = true;
                        match = true;
                        break;
                    }
                }
            }
            if (!match) {
                throw new SeleniumError("Not a frame: " + target);
            }
        }
    }
    // modifies the window
    this.getCurrentWindow();
};

Seems one workaround is to use the "index=" locator if you know the index
of the frame. For example, you can try

ui.Frame(uid: "myframe", locator: "index=1"){
...
}

But not sure if this will work or not. You can try and see if this works.

Thanks,

Jian

On Tue, Nov 3, 2009 at 2:21 AM, Liang HE <[email protected]> wrote:

> Hi Hari,
>
> Thanks for the information. Unfortunately even id doesn't present.
> The iframe tag is like:
> <iframe width="250" height="300" frameborder="no"
> src="unsecureFlow/authentication.htm">
> Seems only src is identical.
>
> Thanks,
> Liang
> On Tue, Nov 3, 2009 at 1:14 PM, Harihara Vinayakaram <[email protected]>wrote:
>
>> Id for the frame does work. I have used it.  The one object for which id
>> does not work is window which needs a name
>>
>> Regards
>> Hari
>>
>>
>> On Tue, Nov 3, 2009 at 6:55 AM, Jian Fang <[email protected]>wrote:
>>
>>> You can try to use id if your frame has one, but I am not sure it will
>>> work.
>>>
>>> What does your frame look like? We may be able to use jQuery to create a
>>> custom method for you some time later.
>>>
>>> Thanks,
>>>
>>> Jian
>>>
>>>
>>> On Mon, Nov 2, 2009 at 8:09 PM, Liang HE <[email protected]> wrote:
>>>
>>>> Hi Jian,
>>>>
>>>> Is "name" the only way to locate a frame in Selenium? Unfortunately the
>>>> application under test doesn't define a name. Any work-around as you know?
>>>>
>>>> Thanks a lot!
>>>> Liang
>>>>
>>>>   On Mon, Nov 2, 2009 at 10:33 PM, Jian Fang 
>>>> <[email protected]>wrote:
>>>>
>>>>> Pass in uid is the correct way to call waitForFrameToLoad(uid,
>>>>> timeout).
>>>>>
>>>>> But for Frame, you should define the name attribute for it because
>>>>> Selenium uses "name" to locate the frame,
>>>>>
>>>>> http://code.google.com/p/aost/wiki/UserGuide070UIObjects#Frame
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Jian
>>>>>
>>>>>
>>>>> On Mon, Nov 2, 2009 at 2:35 AM, Liang HE <[email protected]> wrote:
>>>>>
>>>>>> Hi Friends,
>>>>>>
>>>>>> I can hardly find more information in Tellurium user guide about the
>>>>>> usage of "waitForFrameToLoad". The api says the first argument is
>>>>>> frameAddress, but I don't know what is the frameAddress. I tried to use 
>>>>>> uid,
>>>>>> but get NullPointerException:
>>>>>> java.lang.NullPointerException
>>>>>> at java.net.URLEncoder.encode(URLEncoder.java:188)
>>>>>> at
>>>>>> com.thoughtworks.selenium.DefaultRemoteCommand.urlEncode(DefaultRemoteCommand.java:86)
>>>>>> at
>>>>>> com.thoughtworks.selenium.DefaultRemoteCommand.getCommandURLString(DefaultRemoteCommand.java:59)
>>>>>> at
>>>>>> com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:86)
>>>>>> at
>>>>>> com.thoughtworks.selenium.DefaultSelenium.waitForFrameToLoad(DefaultSelenium.java:639)
>>>>>> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
>>>>>> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1061)
>>>>>> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
>>>>>> at
>>>>>> groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:142)
>>>>>> at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown Source)
>>>>>> at
>>>>>> org.tellurium.dispatch.Dispatcher.invokeMethod(Dispatcher.groovy:26)
>>>>>> at
>>>>>> org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:46)
>>>>>> at
>>>>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
>>>>>> at
>>>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>>>>>> at
>>>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
>>>>>> at
>>>>>> org.tellurium.access.Accessor.waitForFrameToLoad(Accessor.groovy:294)
>>>>>> at org.tellurium.access.Accessor$waitForFrameToLoad.call(Unknown
>>>>>> Source)
>>>>>> at
>>>>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
>>>>>> at
>>>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>>>>>> at
>>>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
>>>>>> Anyone have some clue?
>>>>>>
>>>>>> Thank you!
>>>>>> Liang
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to