This is a migrated thread and some comments may be shown as answers.

Unable to capture Dropdown list items by specified tag

10 Answers 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 02 Feb 2017, 09:13 PM

Hi,

I'm trying to capture the "friendly" name values for list items.  Based on the information I've been able find, I've prioritized the <li> tag in the Project settings, but when I click the list item, instead of recording the list item name value, I'm getting the list item id value to appear in my script.  Given that the list item ids are dynamically generated and can change when new list items are added, I'm trying to get the static name property to be recorded in my script.  This will greatly improve the readability and robustness of my scripts.

I've attached a screenshot showing:

1.  The UI of the actual dropdown and its associated code in the DOM

2.  My project settings showing the prioritized <li> tag

3.  How the elements are recorded in my scripts, and what I'm trying to achieve.

I've tried numerous settings, but the result is always the same.  Any help in this area will be greatly appreciated.

Thanks much,

Dan

10 Answers, 1 is accepted

Sort by
0
Boris
Top achievements
Rank 1
answered on 03 Feb 2017, 01:42 PM

Hello, Dan

What I understand you want to do is to select an element from the dropdown (for example, to select North).

From what I see from the Dom three you can do the following option.

1. Click on step Click "UiId2ListItem" - Run to here option - (Pic-01)

2. Click on step Click ''UiId2ListItem" to select it.

3. Go to Elemets and right click on UiId2ListItem and select Edit Live (Pic-2)

4. Change the Fing Element Logic like this (Pic-3).
    This is if you want to select North if you want to select someting else change TextContent to be West for example.

5. And thеn rename the name of element to be North, this will rename the step to be Click "North" -  (Pic-4).

And run the test, if you still can't select element from dropdown try to check SimulateRealClick. (Pic-5).

I hope I was helpful.

Regarts,
Boris

0
Dan
Top achievements
Rank 1
answered on 03 Feb 2017, 05:01 PM

Hi Boris,

Thanks.  I haven't tried this yet, but I've reviewed your instructions, and I think they contain the missing pieces I need to make this work.  I knew about renaming the elements, but couldn't get the underlying logic (pic 3) to work.

I'll give this a shot, and mark this answered if I get it to work.

Thank you!

0
Dan
Top achievements
Rank 1
answered on 07 Feb 2017, 01:30 AM

Hi Boris,

Sorry it's taken so long to confirm. I've spent a lot of time trying to get this to work, but something's not happening.

The process you outlined for a single control works, but I have 3 controls on the same page with the same name values.  When I try to Edit In Live so that instead of clicking on the element based on its ID property, I'm clicking based on it's TextContent property, If there's already an element that shares the same string, the two elements are merged into a single one, and the first one is persisted while the 2nd element seems to disappear completely. 

I've tried renaming the element both before and after changing the property on which the element is selected, and the result is the same.

I'm not sure, but it seems to me that in my attempts at trying to get this to work, that my elements are not associated with a parent control, so there's not context for keeping these identically named separate from each other.  I noticed in your #3 screenshot example that the Find Element window showed both a parent (dropdown control) and a child (list item).  I don't know why I could never get the parent control to appear in my efforts, but wonder if that's not the cause of my difficulties.

I've attached 3 screenshots, two of which illustrate the steps I've attempted, the element merge that occurs when changing properties, and a comparison of your environment when looking at these elements against my environment when attempting to make these same changes.

Thanks for your help,

Dan

0
Boris
Top achievements
Rank 1
answered on 07 Feb 2017, 10:29 AM
Hi, Dan

Can you send me the whole DOM three to see how are sorted the three dropdown controls?
 
Or if is not a problem to send me the website where you testing. I can make you а project and send it to you.

Regarts,
Boris
0
Elena
Telerik team
answered on 07 Feb 2017, 01:41 PM
Hi guys,

@Boris: Thanks a lot for your cooperation on this issue! I really appreciate it! 

@Dan: Hi, please let me know if further assistance will be required! Thanks! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Dan
Top achievements
Rank 1
answered on 09 Feb 2017, 06:34 PM

I thought I'd replied to this a couple days ago, but posted to Boris' last post.  For some reason that doesn't seem to have taken, so I'm responding to Elena's last post and apologize for the delay.

Because I don't have the authority/ability to provide access to our site, I've attached a modified version of the page where this issue is observed.  Actually, the problem may have been that I attempted to attach a seemingly unsupported attachment type.  I've appended the original file name with *.jpg, so that will have to be removed before you can view it.

Thanks,

Dan

0
Elena
Telerik team
answered on 14 Feb 2017, 02:37 PM
Hello Dan,

I read through the whole prior communication and here are my comments.

First of all I would like to mention that the dropdown control in the provided web page sample is not the same as the one from the initial screenshots. The sample contains a select element and the items in the real tested application are listed as 'li' elements under a 'ul' element. Therefore I am unable to record the same steps. 

The li tag that you have included in the find logic parameters for the project will affect the automatically created find expression of the element during recording. The friendly name of the recorded element will not be changed by this. Did you try to rename the elements as Boris suggested? What was the result? 

Here is an article for the chained find expressions and in what cases they are good to be used. I guess it might be helpful to you. 

Additionally I would like to ask what is the version of Test Studio you have in use? 

Thanks! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Dan
Top achievements
Rank 1
answered on 17 Feb 2017, 05:48 PM

Hi Elena,

I apologize for the delayed response, as I was pulled off on another task.

I would like to provide the DOM for you in the way that would allow you to replicate what I'm seeing.  Is there are recommended method that would allow me to do this and scrub PII before submitting to you?

I did try renaming the elements as Boris suggested.  This worked for the first series of elements, but when I did this for successive elements sharing the same TextContent values, a dialog appeared and indicated that there was already an element with this name, and renamed the successive elements so that instead of having 2 elements with the same name, there was only the first.  Subsequent runs of the scripts would work for the first control, but when the lines for the subsequent elements were performed, they would be executed against the first control in the series.

Again, even though I'd followed Boris' instructions I encountered, two primary issues which seem to prevent me from renaming non-primary elements on the same page sharing the same TextContent value:

1.  The Find Element dialog doesn't show to which control the list items are parented.  In Boris' initial series of screenshots, Pic-3.jpg shows both the parent control and list item.  Following his steps, I was never able to get the parent control to appear in this dialog (only the list item is shown), and I think is the source of my problem.  How can the script run correctly if it's not associated with a specific control (dropdown)?

2.  After renaming the non-primary elements the simply disappear from elements list and are pointed to the first element in the series that shares the same TextContent value.

I have not yet had a chance to follow the instructions in the article you referenced, and I will go through that now to see if I can get this to work.

Either way, I will let you know if this solves my problem.

Thanks,

Dan

0
Dan
Top achievements
Rank 1
answered on 17 Feb 2017, 07:12 PM
I forgot to include that I'm running version 2016.3.928.0
0
Elena
Telerik team
answered on 22 Feb 2017, 01:05 PM
Hello Dan,

Since this is a forum post I understand your concerns of sending me the DOM tree. However I double checked you have a license for Test Studio and under the account holding the license you should be able to submit a support ticket which will be a private one. 

Could you please submit one and refer to this forum post with ID 1087943 in it to skip clarifying the already communicated details. 

Thanks in advance! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Dan
Top achievements
Rank 1
Answers by
Boris
Top achievements
Rank 1
Dan
Top achievements
Rank 1
Elena
Telerik team
Share this question
or