Page 1 of 1

how to handle paths that are incremented by each click...?

Posted: Fri Feb 13, 2015 8:04 am
by nandhu
Hi al,
when tracked the first textbox the path shown is :/dom//input[#'10000001_description']... after a button click event a new textbox is added on the page and the path is:/dom//input[#'10000002_description']...

so, how can we handle these kind of paths in the code... each time when a textbox is added n how to assign the values to that textbox in this condition.Please ping bck asap.......

Re: how to handle paths that are incremented by each click...?

Posted: Mon Feb 16, 2015 12:41 pm
by Support Team
Hi nandhu,

I am not exactly sure if you mean that the RxPath of the already clicked textbox changes or if a new element will be created with an incremented id.
May I ask you to clarify this?
In general you just need to add the additional number the the RxPath used to find the element, since you use code this shouldn't be a problem.

Regards,
Markus

Re: how to handle paths that are incremented by each click...?

Posted: Mon Feb 16, 2015 1:14 pm
by nandhu
Yes, the textboxes id's are changed aftr evry save button click......
And the textboxes id's are incremented whenever we add a new field....
so,can i knw hw to hndle these two scenarios.....

Re: how to handle paths that are incremented by each click...?

Posted: Tue Feb 17, 2015 3:48 pm
by Support Team
Hi nandhu,

You cannot use regular expressions in combination with the unique id search algorithm, you will therefore need to use the "@id" instead of the "#".
Here is a RxPath which would work for both elements:

Code: Select all

/dom//input[@id~'1000000[0-9]_description']
This path will match both cases.
I hope this what you searched for.
To make the RxPath "faster", you could add some of the unique elements between the root dom element and the input tag, in case there are any.

Regards,
Markus

Re: how to handle paths that are incremented by each click...?

Posted: Wed Feb 18, 2015 5:36 am
by nandhu
Thankyou.....

Re: how to handle paths that are incremented by each click...?

Posted: Wed Feb 18, 2015 7:43 am
by nandhu
I implemented this method.... After giving value test1 to first textbox and clicking add button a new textbox is appeared and m giving test2 to second textbox through code but the first textbox value test1 is relplaced with test2..... so hw to overcome this issue could u pls post the solutn....

Re: how to handle paths that are incremented by each click...?

Posted: Thu Feb 19, 2015 4:25 pm
by Support Team
Hi nandhu,

I am afraid I didn't get your question, could you please explain in detail what you are trying to do?

In general, when you want to access an element with another RxPath you need to create another adapter for it, or change the value of the repository item in case you use one.
So please also tell me if you create your adapters in code or if you use the repository.

Thanks,
Markus