Hi Eric,

You want to add your own CSS selector?

Right now, Tellurium CSS selector is generated automatically by the Core
under the hood.
That is to say, if you defined a UI module, Tellurium will traverse to the
UI object
and the CSS selector is generated by combining the UI objects' attributes.
For example, take the
following Google Search module as an example,

ui.Container(uid: "GoogleSearchModule", clocator: [tag: "td"], group: "true"){
   InputBox(uid: "Input", clocator: [title: "Google Search"])
   SubmitButton(uid: "Search", clocator: [name: "btnG", value: "Google Search"])
   SubmitButton(uid: "ImFeelingLucky", clocator: [value: "I'm Feeling Lucky"])
}

If you issue the following command

type "GoogleSearchModule.Input", "Tellurium"

The Tellurium core will first look at the Container's attribute, i.e.,

[tag: "td"]

and then

the InputBox's attributes, i.e.,

 [title: "Google Search"]

with default attribute [tag: "input"]

Aggregate the attributes along the path from the Container to the
InputBox, you can derive
the CSS selector as

td > input[title="Google Search"]

After the CSS selector is generated, a CSS selector optimizer will
optimize the selector, for
example, if you have an id attribute, the optimizer will use the id
alone and ignore other attributes.


Of course, the real case is more complicated if you have UI templates
such as List and Table objects,
but you still get some idea on how it works.

Base on the above, you only need to specify the appropriate attributes
for each UI object and don't really
need to worry about the CSS selector because Tellurium will do all the
work for you.

What is the purpose for you to create a custom CSS selector then?

If you really want to use a CSS selector directly in your UI object,
you could try to use the base locator,
for example,

    ui.Container(uid: "downloads") {
      Selector(uid: "downloadType", locator: "//*...@id='can']")
      InputBox(uid: "input", locator: "//*...@id='q']")
      SubmitButton(uid: "search", locator: "//inp...@value='Search']")
    }

But you will miss a lot of other features in Tellurium.

Thanks,

Jian

On Wed, Dec 22, 2010 at 1:29 AM, Eric Gokavi <[email protected]> wrote:

> Hello Jian,
>
> Thanks for the reply... but i have already tried out the below
> mentioned thing.
> Actually, our requirement is to write a "Custom CSS Selector/ JQuery
> Selector" using Tellurium, my request to you is can you please tell me
> a sample Custom CSS Selector/ JQuery Selector code you have
> implemented which i can refer to or any Tellurium Sites references for
> the same.
>
> Kindly get back to me.
>
> Thanks,
> -Eric.
>
> On Dec 20, 7:05 pm, Jian Fang <[email protected]> wrote:
> > Which version of Tellurium are you using?
> >
> > You could try
> >
> > mod.enableCssSelector()
> >
> > to enable CssSelector and
> >
> > mod.disableCssSelector()
> >
> > to change back to xpath.
> >
> > jQuery selector has been renamed to CSS selector since 0.7.0.
> >
> > Thanks,
> >
> > Jian
> >
> > On Mon, Dec 20, 2010 at 7:14 AM, Eric Gokavi <[email protected]>
> wrote:
> > > Hello,
> >
> > > I have been using Tellurium for some time now but i was not able to
> > > figure out how to use JQuerySelector.
> > > My test case code is
> >
> > > Module mod;
> > >  @BeforeClass
> > >    public static void init(){
> > >        mod= new Module ();
> > >        mod.defineUi();
> > >    }
> >
> > >  @Test
> > >    public void testInfinity(){
> > >        mod.useJQuerySelector();
> > >    }
> >
> > > but when i run the tests i get the following error mentioned below.
> >
> > > [INFO] Compilation failure
> > > [INFO] cannot find symbol
> > > symbol  : method useJQuerySelector()
> >
> > > is there some setting in tellurium i need to do to enable
> > > JQuerySelector, if yes can you guide me on that.
> >
> > > Thanks,
> > > -Eric.
> >
> > > --
> > > 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]<tellurium-users%[email protected]>
> <tellurium-users%[email protected]<tellurium-users%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/tellurium-users?hl=en.
>
> --
> 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]<tellurium-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/tellurium-users?hl=en.
>
>

-- 
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