You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Niels van Kampenhout <n....@hippo.nl> on 2007/11/20 13:42:48 UTC
Wicket, Selenium and generated id attributes
Hi,
I am experimenting with Selenium tests for our Wicket application. Many
of my test have code like
selenium.click("login_dialog_link22");
Because the id "login_dialog_link22" is generated by Wicket, and changes
often as the app is still under heavy development, it's a bit of a PITA
to keep the tests in sync.
Anyone knows a neat way to make the tests more robust? Can I influence
the generated id?
Thanks,
Niels
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket, Selenium and generated id attributes
Posted by Niels van Kampenhout <n....@hippo.nl>.
Timo Rantalaiho wrote:
> On Tue, 20 Nov 2007, Gerolf Seitz wrote:
>> you can call setMarkupId(String) in the constructor of your components.
>> just make sure that the ids are unique in a single page.
>
> This works sometimes, and is a good idea. Having stable HTML
> ids for unique HTML elements also makes facilitates good CSS
> styling, I understand.
>
> However, when this is not practical, you can omit the HTML
> id altogether from the markup, because then Selenium IDE
> will automatically look for other ways of identifying the
> element. These are typically xpath expressions operating on
> the DOM tree. You can of course also write them yourself to
> the test script, if you like xpath ;)
>
> When using Selenium in a more white-box-way, testing single
> components within developer tests, there is also the
> possibility of getting the dynamic markup id directly from
> the component object. This can be done at least with
> SeleniumTestCase of Wicket Bench and I believe also with
> jdave-wicket-selenium
>
> http://www.jdave.org/modules.html
Thanks everyone for the suggestions, they sound very useful :)
Cheers
Niels
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket, Selenium and generated id attributes
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Tue, 20 Nov 2007, Gerolf Seitz wrote:
> you can call setMarkupId(String) in the constructor of your components.
> just make sure that the ids are unique in a single page.
This works sometimes, and is a good idea. Having stable HTML
ids for unique HTML elements also makes facilitates good CSS
styling, I understand.
However, when this is not practical, you can omit the HTML
id altogether from the markup, because then Selenium IDE
will automatically look for other ways of identifying the
element. These are typically xpath expressions operating on
the DOM tree. You can of course also write them yourself to
the test script, if you like xpath ;)
When using Selenium in a more white-box-way, testing single
components within developer tests, there is also the
possibility of getting the dynamic markup id directly from
the component object. This can be done at least with
SeleniumTestCase of Wicket Bench and I believe also with
jdave-wicket-selenium
http://www.jdave.org/modules.html
Best wishes,
Timo
--
Timo Rantalaiho +358-45-6709709
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket, Selenium and generated id attributes
Posted by Gerolf Seitz <ge...@gmail.com>.
you can call setMarkupId(String) in the constructor of your components.
just make sure that the ids are unique in a single page.
Gerolf
On Nov 20, 2007 1:42 PM, Niels van Kampenhout <n....@hippo.nl>
wrote:
> Hi,
>
> I am experimenting with Selenium tests for our Wicket application. Many
> of my test have code like
>
> selenium.click("login_dialog_link22");
>
> Because the id "login_dialog_link22" is generated by Wicket, and changes
> often as the app is still under heavy development, it's a bit of a PITA
> to keep the tests in sync.
>
> Anyone knows a neat way to make the tests more robust? Can I influence
> the generated id?
>
> Thanks,
>
> Niels
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Wicket, Selenium and generated id attributes
Posted by karthik Guru <be...@gmail.com>.
Does selenium works with names?
I mean something like -
selenium.click("login"); with the mark up having -
<a wicket:id="login" name="login">Login</a>
But yes, this *might* work for links that you know up front but not the ones
that are generated through a loop component for e.g.
On Nov 20, 2007 6:12 PM, Niels van Kampenhout <n....@hippo.nl>
wrote:
> Hi,
>
> I am experimenting with Selenium tests for our Wicket application. Many
> of my test have code like
>
> selenium.click("login_dialog_link22");
>
> Because the id "login_dialog_link22" is generated by Wicket, and changes
> often as the app is still under heavy development, it's a bit of a PITA
> to keep the tests in sync.
>
> Anyone knows a neat way to make the tests more robust? Can I influence
> the generated id?
>
> Thanks,
>
> Niels
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
-- karthik --