You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by nino martinez wael <ni...@gmail.com> on 2010/10/04 12:57:08 UTC

Selenium Regex?

Hi

has anyone created a regex to find wicket paths to use with selenium?
I did search nabble, and found a post but it does not seem work.

regards Nino

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Selenium Regex?

Posted by nino martinez wael <ni...@gmail.com>.
hehe, you probably need to fix my memory too then, although I do
remember vaguely that there was a change for it, probably for
selenium.. And great this is the way for us I think.

Now I just need to read Martin M's mail :)

2010/10/4 Martin Grigorov <mg...@apache.org>:
> On Mon, Oct 4, 2010 at 7:26 PM, nino martinez wael <
> nino.martinez.wael@gmail.com> wrote:
>
>> thanks. But we seem to have problems running XPath searching for
>> wicket:id or wicket:path, problem being the semicolon. Might be that
>> we are doing something wrong?
>>
> I need to fix the javadoc. Since a while Wicket produces "wicketpath", not
> "wicket:path". It shouldn't be a problem.
>
>>
>> regards Nino
>>
>> 2010/10/4 Martin Grigorov <mg...@apache.org>:
>> > With
>> org.apache.wicket.settings.IDebugSettings.setOutputComponentPath(true)
>> > Wicket will dump 'wicket:path' attribute for each component tag.
>> > you can find the elements with XPath
>> >
>> > On Mon, Oct 4, 2010 at 3:43 PM, nino martinez wael <
>> > nino.martinez.wael@gmail.com> wrote:
>> >
>> >> Hmm, it's pretty intrusive. I wanted to have a "simple" selenium test
>> >> running. I'll get back once we find a solution.
>> >>
>> >> regards Nino
>> >>
>> >> 2010/10/4 Martin Grigorov <mg...@apache.org>:
>> >> > Check http://wicketpagetest.sourceforge.net/ as well.
>> >> >
>> >> > On Mon, Oct 4, 2010 at 1:08 PM, Martin Makundi <
>> >> > martin.makundi@koodaripalvelut.com> wrote:
>> >> >
>> >> >> Hi!
>> >> >>
>> >> >> Maybe you can integrate wickettester with selenium in a way that you
>> >> >> can use live paths:
>> >> >>
>> >> >> https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html
>> >> >>
>> >> >> **
>> >> >> Martin
>> >> >>
>> >> >> 2010/10/4 nino martinez wael <ni...@gmail.com>:
>> >> >> > Hi
>> >> >> >
>> >> >> > has anyone created a regex to find wicket paths to use with
>> selenium?
>> >> >> > I did search nabble, and found a post but it does not seem work.
>> >> >> >
>> >> >> > regards Nino
>> >> >> >
>> >> >> >
>> ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >>
>> >> >>
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Selenium Regex?

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Oct 4, 2010 at 7:26 PM, nino martinez wael <
nino.martinez.wael@gmail.com> wrote:

> thanks. But we seem to have problems running XPath searching for
> wicket:id or wicket:path, problem being the semicolon. Might be that
> we are doing something wrong?
>
I need to fix the javadoc. Since a while Wicket produces "wicketpath", not
"wicket:path". It shouldn't be a problem.

>
> regards Nino
>
> 2010/10/4 Martin Grigorov <mg...@apache.org>:
> > With
> org.apache.wicket.settings.IDebugSettings.setOutputComponentPath(true)
> > Wicket will dump 'wicket:path' attribute for each component tag.
> > you can find the elements with XPath
> >
> > On Mon, Oct 4, 2010 at 3:43 PM, nino martinez wael <
> > nino.martinez.wael@gmail.com> wrote:
> >
> >> Hmm, it's pretty intrusive. I wanted to have a "simple" selenium test
> >> running. I'll get back once we find a solution.
> >>
> >> regards Nino
> >>
> >> 2010/10/4 Martin Grigorov <mg...@apache.org>:
> >> > Check http://wicketpagetest.sourceforge.net/ as well.
> >> >
> >> > On Mon, Oct 4, 2010 at 1:08 PM, Martin Makundi <
> >> > martin.makundi@koodaripalvelut.com> wrote:
> >> >
> >> >> Hi!
> >> >>
> >> >> Maybe you can integrate wickettester with selenium in a way that you
> >> >> can use live paths:
> >> >>
> >> >> https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html
> >> >>
> >> >> **
> >> >> Martin
> >> >>
> >> >> 2010/10/4 nino martinez wael <ni...@gmail.com>:
> >> >> > Hi
> >> >> >
> >> >> > has anyone created a regex to find wicket paths to use with
> selenium?
> >> >> > I did search nabble, and found a post but it does not seem work.
> >> >> >
> >> >> > regards Nino
> >> >> >
> >> >> >
> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Selenium Regex?

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Save 60% of your time with type safe testing.

It's doable with selenium also.

Couplings between tests and the GUI#

The only thing to watch for in Selenium is the number and tightness of
couplings from test code to the application. Both can be managed.

First let's look at the tightness of couplings. Since Selenium
operates on the browser test code can only be coupled to HTML
elements. Selenium has several ways to locate HTML elements, in
preferred order:

    * Element name or ID
    * Xpath statement
          o Search
          o Absolute path
    * DOM

For more information see Selenium documentation:

http://seleniumhq.org/docs/06_test_design_considerations.html#choosing-a-location-strategy

Using an absolute Xpath expression to locate an element couples the
test tightly to the structure of HTML. If any element changes place or
is renamed, the Xpath will break. For example the following code
fragment clicks the checkout button of Cheesr's shopping cart.

selenium.click("/html/body/div[@id='container']/div[@id='content']/div[@id='cart']/input");

Using an Xpath search removes some of the couplings and allows at
least some parts of the page to change without breaking tests.

selenium.click("//div[@id='cart']/input");

Locating by element name or ID has the least possible coupling since
the location of the element in the HTML page does not matter. That
assumes that names or IDs can be added to templates (and remember that
Wicket sometimes changes element IDs on the fly).

selenium.click("checkout-button");

Number of couplings here means simply how many times a certain HTML
element (directly or as part of a path) is referred in test code. If
the Xpath "//div@id='cart'/input" appears in test code once then there
is one coupling from tests to two HTML elements (div, input). If the
same Xpath expression appears n times the number of couplings is
multiplied by n. Of course if the same HTML elements are included in
other Xpaths the number of couplings increases, too. At it worst if
test code (including xpaths) are copy pasted the number of couplings
can explode and make it impossible to change the GUI due to hundreds
of broken tests.

This is not really a Selenium problem as such, and any tests with
duplication on any framework will have similar problems. Xpath just
makes such duplication easier to create. The cure is carefully
designed and refactored test code that does not violate the DRY
principle in code or in data (Xpaths are data).

In summary, for best possible tests reduce the number of couplings by
eliminating duplication in test code, and manage the tightness of
couplings by preferring to locate HTML elements with names, IDs or
Xpath searches.

Xpath performance#

Xpath performance in Internet Explorer is atrocious. If that's a
problem, consider using DOM locators instead of Xpath locators. If I'm
not mistaken, that's why they were added to Selenium in the first
place.


2010/10/4 nino martinez wael <ni...@gmail.com>:
> thanks. But we seem to have problems running XPath searching for
> wicket:id or wicket:path, problem being the semicolon. Might be that
> we are doing something wrong?
>
> regards Nino
>
> 2010/10/4 Martin Grigorov <mg...@apache.org>:
>> With org.apache.wicket.settings.IDebugSettings.setOutputComponentPath(true)
>> Wicket will dump 'wicket:path' attribute for each component tag.
>> you can find the elements with XPath
>>
>> On Mon, Oct 4, 2010 at 3:43 PM, nino martinez wael <
>> nino.martinez.wael@gmail.com> wrote:
>>
>>> Hmm, it's pretty intrusive. I wanted to have a "simple" selenium test
>>> running. I'll get back once we find a solution.
>>>
>>> regards Nino
>>>
>>> 2010/10/4 Martin Grigorov <mg...@apache.org>:
>>> > Check http://wicketpagetest.sourceforge.net/ as well.
>>> >
>>> > On Mon, Oct 4, 2010 at 1:08 PM, Martin Makundi <
>>> > martin.makundi@koodaripalvelut.com> wrote:
>>> >
>>> >> Hi!
>>> >>
>>> >> Maybe you can integrate wickettester with selenium in a way that you
>>> >> can use live paths:
>>> >>
>>> >> https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html
>>> >>
>>> >> **
>>> >> Martin
>>> >>
>>> >> 2010/10/4 nino martinez wael <ni...@gmail.com>:
>>> >> > Hi
>>> >> >
>>> >> > has anyone created a regex to find wicket paths to use with selenium?
>>> >> > I did search nabble, and found a post but it does not seem work.
>>> >> >
>>> >> > regards Nino
>>> >> >
>>> >> > ---------------------------------------------------------------------
>>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>>> >> >
>>> >> >
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> >> For additional commands, e-mail: users-help@wicket.apache.org
>>> >>
>>> >>
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Selenium Regex?

Posted by nino martinez wael <ni...@gmail.com>.
thanks. But we seem to have problems running XPath searching for
wicket:id or wicket:path, problem being the semicolon. Might be that
we are doing something wrong?

regards Nino

2010/10/4 Martin Grigorov <mg...@apache.org>:
> With org.apache.wicket.settings.IDebugSettings.setOutputComponentPath(true)
> Wicket will dump 'wicket:path' attribute for each component tag.
> you can find the elements with XPath
>
> On Mon, Oct 4, 2010 at 3:43 PM, nino martinez wael <
> nino.martinez.wael@gmail.com> wrote:
>
>> Hmm, it's pretty intrusive. I wanted to have a "simple" selenium test
>> running. I'll get back once we find a solution.
>>
>> regards Nino
>>
>> 2010/10/4 Martin Grigorov <mg...@apache.org>:
>> > Check http://wicketpagetest.sourceforge.net/ as well.
>> >
>> > On Mon, Oct 4, 2010 at 1:08 PM, Martin Makundi <
>> > martin.makundi@koodaripalvelut.com> wrote:
>> >
>> >> Hi!
>> >>
>> >> Maybe you can integrate wickettester with selenium in a way that you
>> >> can use live paths:
>> >>
>> >> https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html
>> >>
>> >> **
>> >> Martin
>> >>
>> >> 2010/10/4 nino martinez wael <ni...@gmail.com>:
>> >> > Hi
>> >> >
>> >> > has anyone created a regex to find wicket paths to use with selenium?
>> >> > I did search nabble, and found a post but it does not seem work.
>> >> >
>> >> > regards Nino
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Selenium Regex?

Posted by Martin Grigorov <mg...@apache.org>.
With org.apache.wicket.settings.IDebugSettings.setOutputComponentPath(true)
Wicket will dump 'wicket:path' attribute for each component tag.
you can find the elements with XPath

On Mon, Oct 4, 2010 at 3:43 PM, nino martinez wael <
nino.martinez.wael@gmail.com> wrote:

> Hmm, it's pretty intrusive. I wanted to have a "simple" selenium test
> running. I'll get back once we find a solution.
>
> regards Nino
>
> 2010/10/4 Martin Grigorov <mg...@apache.org>:
> > Check http://wicketpagetest.sourceforge.net/ as well.
> >
> > On Mon, Oct 4, 2010 at 1:08 PM, Martin Makundi <
> > martin.makundi@koodaripalvelut.com> wrote:
> >
> >> Hi!
> >>
> >> Maybe you can integrate wickettester with selenium in a way that you
> >> can use live paths:
> >>
> >> https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html
> >>
> >> **
> >> Martin
> >>
> >> 2010/10/4 nino martinez wael <ni...@gmail.com>:
> >> > Hi
> >> >
> >> > has anyone created a regex to find wicket paths to use with selenium?
> >> > I did search nabble, and found a post but it does not seem work.
> >> >
> >> > regards Nino
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Selenium Regex?

Posted by nino martinez wael <ni...@gmail.com>.
Hmm, it's pretty intrusive. I wanted to have a "simple" selenium test
running. I'll get back once we find a solution.

regards Nino

2010/10/4 Martin Grigorov <mg...@apache.org>:
> Check http://wicketpagetest.sourceforge.net/ as well.
>
> On Mon, Oct 4, 2010 at 1:08 PM, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
>
>> Hi!
>>
>> Maybe you can integrate wickettester with selenium in a way that you
>> can use live paths:
>>
>> https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html
>>
>> **
>> Martin
>>
>> 2010/10/4 nino martinez wael <ni...@gmail.com>:
>> > Hi
>> >
>> > has anyone created a regex to find wicket paths to use with selenium?
>> > I did search nabble, and found a post but it does not seem work.
>> >
>> > regards Nino
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Selenium Regex?

Posted by Martin Grigorov <mg...@apache.org>.
Check http://wicketpagetest.sourceforge.net/ as well.

On Mon, Oct 4, 2010 at 1:08 PM, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> Hi!
>
> Maybe you can integrate wickettester with selenium in a way that you
> can use live paths:
>
> https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html
>
> **
> Martin
>
> 2010/10/4 nino martinez wael <ni...@gmail.com>:
> > Hi
> >
> > has anyone created a regex to find wicket paths to use with selenium?
> > I did search nabble, and found a post but it does not seem work.
> >
> > regards Nino
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Selenium Regex?

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

Maybe you can integrate wickettester with selenium in a way that you
can use live paths:

https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html

**
Martin

2010/10/4 nino martinez wael <ni...@gmail.com>:
> Hi
>
> has anyone created a regex to find wicket paths to use with selenium?
> I did search nabble, and found a post but it does not seem work.
>
> regards Nino
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org