Mikhail,

Please commit your code to
 https://aost.googlecode.com/svn/branches/core-jlocator
so that I and other team members can take a look.

To be able to support multiple elements, we may have to modify the
selenium
core or we should start our own Engine project earlier so that we will
not
be constrained by Selenium implementation. Would it be possible for us
to start
the Engine project in an agile way, that is to say, for most regular
calls from
Tellurium to Selenium, we still use Selenium core. But for your jquery
selectors
and multiple element support, we start to write a small engine that
only includes the
extra methods you provide. How much effort if we do in this way and is
it doable?

Thanks,

Jian

On Dec 4, 9:50 am, Mikhail Koryak <[EMAIL PROTECTED]> wrote:
> I have been giving this more thought, let me know what you think about
> this:
>
> group locators should get the extra methods that i provide, because by
> definition they group a set of elements. right now, they are used to
> more precisely locate their enclosing elements, right? we can add
> these extra methods to them and let these methods act on all elements
> that the locator groups. also, we can provide an optional argument to
> the methods called 'filter' which will filter the grouped set.
>
> On Dec 3, 11:09 pm, Mikhail Koryak <[EMAIL PROTECTED]> wrote:
>
> > its possible to dynamically create jquery selectors, but since all
> > current locators will select a single element, the generated jquery
> > selectors will also locate a single element. since jquery selectors
> > and xpath locators at the end do the same thing - select some
> > elements.
>
> > most of the time, i will use a clocator that looks like this
> > [id:"someid", name:"somename"] - it has to locate a single element, or
> > none of the selenium methods will work correctly, right? ive never
> > tried to make a clocator that will use a class name only. what is the
> > outcome of that? i dont think it will work.
>
> > that is the problem, we cannot dynamically make a locator that locates
> > a single element, locate mulitples... unless.. we can use a group
> > locator, and try to act on the entire group of all elements under that
> > element.. ?
>
> > On Dec 3, 3:24 pm, [EMAIL PROTECTED] wrote:
>
> > > You have very good point here. Is it possible for you to dynamically
> > > create
> > > the JQuery selectors based on a set of criteria/attributes passed in?
> > > Then
> > > you may not have the limit of one locator maps to one element by
> > > treating
> > > the set of criteria/attributes as a special locator. That is to say,
> > > we only
> > > pass in a special locator and under the hood, you will generate
> > > multiple
> > > ones at the js level. Let me know if I understand the question
> > > correctly or not.
>
> > > I agree, we may only need to return multiple objects on your new
> > > methods.
>
> > > On Dec 3, 2:27 pm, Mikhail Koryak <[EMAIL PROTECTED]> wrote:
>
> > > > I think you may have misunderstood. I am not talking about anything at
> > > > the java level when i say a locator cannot return multiple elements.
> > > > at the selenium js level, a locator can only return 1 element, except
> > > > for the table locator, but that is a special case, and uses a subset
> > > > of selenium-core methods not used by the rest of the locators.
> > > > so, let us agree that any locator must return a single element, unless
> > > > we heavily modify selenium-core (i think it will take a rewrite).
>
> > > > so, currently all tellurium locators return a single element.
> > > > my new methods work best if you pass in a jquery selector that will
> > > > select multiple elements. Under the hood, i added a new location
> > > > strategy, ie a new locator which actually returns multiple elements,
> > > > but it is only used by my user-extension methods, so it does not break
> > > > anything.
>
> > > > so, it looks to me that we cannot add my new methods to any UiObjects
> > > > because every UiObject provides a locator, as you mentioned above, and
> > > > these locators can only return a single element.
> > > > Ofcourse, my new methods can remain as methods of DslContext, and
> > > > maybe that is the right thing to do for now.
>
> > > > to illustrate what i mean, here is the user-extension for one of the
> > > > methods:
>
> > > > Selenium.prototype.getSelectorText = function(jq){
> > > >         var e = this.browserbot.findElement("jqueryall="+jq); //use a 
> > > > custom
> > > > locator that returns a jquery wrapped set given a jquery selector
> > > >         var out = [];
> > > >         for(var i = 0; i < e.length; i++){ //iterate over the entire 
> > > > wrapped
> > > > set, and collect information into an array
> > > >                 out.push($(e[i]).text()); //using jquery
> > > >         }
> > > >         return JSON.stringify(out); //stringify the list and return to 
> > > > client
> > > > where it will be parsed back into a list
>
> > > > };
>
> > > > i see a lot of power in being able to craft a jquery selector that
> > > > selects multiple elements, and gathering information from ALL of them
> > > > in one call.
>
> > > > On Dec 3, 1:20 pm, [EMAIL PROTECTED] wrote:
>
> > > > > The UiObject contains one locator, which could be BaseLocator,
> > > > > CompositeLocator,
> > > > > or the JQueryLocator you define. It is fine to return an array of
> > > > > objects from
> > > > > one locator. For example, you may return an ArrayList for a table row
> > > > > and you
> > > > > still use the table's locator and pass in the row number as another
> > > > > parameter.
> > > > > Under the hood, either the Table or the JQuery at selenium core will
> > > > > handle how
> > > > > to select multiple UI elements. As a result, the multiple UI elements
> > > > > would not
> > > > > be exposed to the DslContext layer, i.e., users.
>
> > > > > I do not know if I understand your questions correctly or not. Could
> > > > > you give some examples here
> > > > > for us to discuss further?
>
> > > > > Thanks,
>
> > > > > Jian
>
> > > > > On Dec 3, 11:56 am, Mikhail Koryak <[EMAIL PROTECTED]> wrote:
>
> > > > > > Ive extended DslContext to support the following calls:
>
> > > > > > def ArrayList getSelectorProperties(String jqSelector, List<String>
> > > > > > props)
> > > > > > def ArrayList getSelectorText(String jqSelector)
> > > > > > def Object getSelectorFunctionCall(String jqSelector, String fn)
>
> > > > > > the first function takes a jquery selector, and a list of DOM
> > > > > > properties to gather, and returns an array list of hashmaps 
> > > > > > containing
> > > > > > a mapping of the given propeties to their values in the DOM elements
> > > > > > selected by the given jquery
>
> > > > > > the second function returns an array list of strings where each 
> > > > > > string
> > > > > > is the text of each element selected by the jquery
>
> > > > > > the last function is a genetic function that takes jquery selector 
> > > > > > and
> > > > > > a String contain a javascript function which will be called with the
> > > > > > context of the wrapped set selected by the jquery selector (ie 
> > > > > > 'this')
> > > > > > and must return json which will be returned as either a HashMap or
> > > > > > ArrayList
>
> > > > > > I think these 3 functions give us a foundation to build any 
> > > > > > imaginable
> > > > > > call that can return any number of values.
>
> > > > > > The only problem i see with the current setup is that it can not be
> > > > > > used with the current UiObjects which already contain locators, but
> > > > > > these locators only select a single element, and are not as useful 
> > > > > > as
> > > > > > full fledged jquery locators.
> > > > > > Do you have any thoughts on how to make this functionality work more
> > > > > > in line with the framework?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to tellurium-users@googlegroups.com
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