Rename addNamespace() to registerNamespace() and add namespace to
xpath builder.
As a result, Tellurium core supports namespace definition now, but you
need to register
namespace prefix before actually test the UI module.

For example, look at SampleUI module

        ui.Form(uid: "SubmitForm", namespace: "xforms", clocator:[:]){
          InputBox(uid: "Input", namespace: "xforms", clocator:
[module: "clinicalExaminationModel"])
          TextBox(uid: "Label", namespace: "xforms", clocator: [tag:
"label"])
        }


The generated xpath for "SubmitForm.Input" is

//descendant-or-self::xforms:form/descendant-or-self::xforms:input
[...@module=\"clinicalExaminationModel\"]

and the xpath for "SubmitForm.Label" is

//descendant-or-self::xforms:form/descendant-or-self::xforms:label

Then call

registerNamespace("xform", XFORM_URI)

to register namespace after Selenium Server is up and running.

I do not have any web site to test, please let me know if this works
for you.

Thanks,

Jian


On Apr 27, 4:59 pm, John <[email protected]> wrote:
> I refactored the Selenium core a bit to allow custom namespaces. I
> added
> two methods in core DslContext to set and get namespaces. For example,
> see the
> following test in GoogleSearchTestCase:
>
>     @Test
>     public void testAddNamespace(){
>         String te_ns = "http://tellurium.org/ns";;
>         gsm.addNamespace("te", te_ns);
>         String ns = gsm.getNamespace("te");
>         assertNotNull(ns);
>         assertEquals(te_ns, ns);
>     }
>
> You may also notice that there is a namespace attribute in Tellurium
> UI object,
> which is reserved for future usage. If you really need to use
> namespace,
> we can use this namespace attribute to automatically generate
> namespace prefix
> in the generated xpath. Let me know if this sounds good for you.
>
> Thanks,
>
> Jian
>
> On Apr 27, 9:44 am, John <[email protected]> wrote:
>
> > The simple and straightforward way is to add your namespace to the
> > BrowserBot.prototype._namespaceResolver
> > method and then re-jar Selenium server. We may be able to refactor
> > Selenium implementation for this part,
> > for example, use a hash map to store all namespaces so that it is
> > convenient to add custom namespace to it
> > by calling custom API.
>
> > On Apr 26, 10:13 am, Harihara Vinayakaram <[email protected]> wrote:
>
> > > Thanks John . I have a namespace resolver which resolves my xf, but I did
> > > not know about the _namespaceResolver . I will try that and see if that
> > > works for all my functions
>
> > > My experiments with jquery and namespaces did not go too far. 1.2.6 was
> > > broken while 1.3.2 did not perform too well . Let me see if I can write 
> > > some
> > > custom modules . I seem to have gotten used to the Tellurium way of doing
> > > things and the plan selenium way feels difficult :-)
>
> > > Regards
> > > Hari
>
> > > On Sun, Apr 26, 2009 at 10:19 AM, John <[email protected]> wrote:
>
> > > > On Apr 25, 2:33 am, Harihara Vinayakaram <[email protected]> wrote:
> > > > > Hi
> > > > >    I have added methods to access the XForm as part of the
> > > > > user-extensions.js and I am able to test them with Selenium
>
> > > > >    I am faced with the following questions :
>
> > > > > 1)
> > > > >    I cannot define a XForm module since the module definitions do not
> > > > take a
> > > > > name space in the tag.   I am not sure what is the best way of over
> > > > coming
> > > > > that
>
> > > > Selenium uses XPath in the following way,
>
> > > >  var results = eval_xpath(xpath, inDocument, {
> > > >        ignoreAttributesWithoutValue:
> > > > this.ignoreAttributesWithoutValue,
> > > >        allowNativeXpath            : this.allowNativeXpath,
> > > >        xpathLibrary                : this.xpathLibrary,
> > > >        namespaceResolver           : this._namespaceResolver
> > > >    });
>
> > > > Here the namespaceResolver is as follows
>
> > > > BrowserBot.prototype._namespaceResolver = function(prefix) {
> > > >    if (prefix == 'html' || prefix == 'xhtml' || prefix == 'x') {
> > > >        return 'http://www.w3.org/1999/xhtml';
> > > >    } else if (prefix == 'mathml') {
> > > >        return 'http://www.w3.org/1998/Math/MathML';
> > > >    } else {
> > > >        throw new Error("Unknown namespace: " + prefix + ".");
> > > >    }
> > > > }
>
> > > > Perhaps, you have to modify the namespaceResolver to include your
> > > > namespace.
>
> > > > One other option is to use jQuery and seems jQuery also supports
> > > > XPath and namespace, for instance, see the following post
>
> > > >http://www.xml.com/pub/a/2007/10/10/jquery-and-xml.html?page=2
>
> > > > I have not thought of this support yet. But can consider this if you
> > > > really
> > > > want it.
>
> > > > > 2)
> > > > >    Some of the XForm controls are not visible in the DOM (The XForm
> > > > > processor  in Mozilla uses XBL bindings and these are not visible in 
> > > > > the
> > > > DOM
> > > > > ).. One example of this is the XForm Repeat tag. I am not sure how I 
> > > > > can
> > > > > define them in the UI module
>
> > > > Repeat tag is used to control the rendering, right? Sounds like a good
> > > > fit for
> > > > UI templates. You can define a List and use template for the repeat
> > > > tag.
>
> > > > > 3)
> > > > >    Some of my tests which do not use XForm specific inputs are coded 
> > > > > as
> > > > > Tellurium modules (having init etc ) while the others need to be 
> > > > > accessed
> > > > as
> > > > > selenium . Is there a way I can mix these 2 (Not sure if that is a 
> > > > > good
> > > > idea
> > > > > . Is there somekind of get the selenium object of Tellurium )
> > > > Tellurium covers pretty much all methods in Selenium, why you need to
> > > > use
> > > > selenium directly? You can use
>
> > > > customDirectCall(String method, Object[] args)
>
> > > > to pass your call to selenium directly.
>
> > > > > Regards
> > > > > Hari
--~--~---------~--~----~------------~-------~--~----~
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