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

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

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

Post by nandhu » Fri Feb 13, 2015 8:04 am

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.......
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

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

Post by Support Team » Mon Feb 16, 2015 12:41 pm

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

nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

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

Post by nandhu » Mon Feb 16, 2015 1:14 pm

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

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

Post by Support Team » Tue Feb 17, 2015 3:48 pm

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

nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

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

Post by nandhu » Wed Feb 18, 2015 5:36 am

Thankyou.....

nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

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

Post by nandhu » Wed Feb 18, 2015 7:43 am

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

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

Post by Support Team » Thu Feb 19, 2015 4:25 pm

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