Currently I'm using Ranorex Studio Trial Version. We have a web application & we want to automate the Test cases using Ranorex.
The problem I'm facing currently is, there are multiple items (or web elements) in the in the application dashboard that shares one common class (that means all these elements having the same class, but their other attributes are different from each other).
Now, I want to get the total size of these elements using user code. How to do that in Ranorex Studio ?
How to get the total size of the WebElements that has common class ?
Re: How to get the total size of the WebElements that has common class ?
Hi,
I'm not exactly sure what is your goal? Could you please share more details about what exactly you want to achieve? What do you want to do with "size" of web element?
Ideally, please create and post a Ranorex snapshot and exact steps you want to perform, including some screenshots
Thanks.
I'm not exactly sure what is your goal? Could you please share more details about what exactly you want to achieve? What do you want to do with "size" of web element?
Ideally, please create and post a Ranorex snapshot and exact steps you want to perform, including some screenshots

Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to get the total size of the WebElements that has common class ?
Thanks @odklizec for the reply.
Suppose there is a dropdown in my application. This dropdown is having thousands of options (e.g. Option A, Option B,.......Option n). I want to get the total number of options present in this dropdown list. How to do that programmatically (i.e. using C#) in Ranorex Studio ?
Suppose there is a dropdown in my application. This dropdown is having thousands of options (e.g. Option A, Option B,.......Option n). I want to get the total number of options present in this dropdown list. How to do that programmatically (i.e. using C#) in Ranorex Studio ?
Re: How to get the total size of the WebElements that has common class ?
Hi,
Thanks for the explanation. Now I understand
Well, it could be a very easy task, if the list of elements is entirely loaded. Or a pretty complicated one, if the list is lazy loaded (i.e. only the items visible in dropdown without scrolling are loaded in memory)
Could you please post a Ranorex snapshot (NOT screenshot) of the dropdown in question?
Thanks for the explanation. Now I understand


Could you please post a Ranorex snapshot (NOT screenshot) of the dropdown in question?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to get the total size of the WebElements that has common class ?
Hi @odklizec,
Thanks for the reply. Please find the attached snapshot.
Also one thing I want to add, when clicked on the said dropdown list, all the elements (i.e. entire options) are loaded at that time.
Thanks for the reply. Please find the attached snapshot.
Also one thing I want to add, when clicked on the said dropdown list, all the elements (i.e. entire options) are loaded at that time.

- Attachments
-
- dropdown.rxsnp
- snapshot of the dropdown element
- (67.72 KiB) Downloaded 103 times
Re: How to get the total size of the WebElements that has common class ?
Hi,
Thanks for the snapshot, but it's a snapshot of entire page! Please create one just for the dropdown.
Start tracking, press and hold F12 (to pause tracking), then click in dropdown to expand it, and then with mouse still above the expanded dropdown, release F12 and select the dropdown.
Thanks for the snapshot, but it's a snapshot of entire page! Please create one just for the dropdown.
Start tracking, press and hold F12 (to pause tracking), then click in dropdown to expand it, and then with mouse still above the expanded dropdown, release F12 and select the dropdown.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to get the total size of the WebElements that has common class ?
Hi @odklizec,
Please find the updated snapshot. Hope this one helps.
Please find the updated snapshot. Hope this one helps.
- Attachments
-
- dropdown.rxsnp
- snapshot of dropdown list
- (90.63 KiB) Downloaded 105 times
Re: How to get the total size of the WebElements that has common class ?
Hi,
Yes, it's much better now.
So basically, this xpath returns all items of given dropdown:
Just create a repo element with above xpath.
Now with this method, you should be able to get number of dropdown items:Simply create a UserCode with above method in Recording module of your choice and assign the repo element as a parameter. Hope this helps?
Yes, it's much better now.
So basically, this xpath returns all items of given dropdown:
Code: Select all
/dom[@domain='u01061loto01.tiretech.contiwan.com']//form//div[@class~'p-dropdown-panel']/?/?/ul[@class~'p-dropdown-items']/tag/li[@class~'p-dropdown-item']/span[@visible='true']
Now with this method, you should be able to get number of dropdown items:
Code: Select all
private void SelectMultipleCheckboxes(RepoItemInfo repoElement)
{
// Create a list of adapters using the "Info" object
IList<Ranorex.SpanTag> spanList = repoElement.CreateAdapters<Ranorex.SpanTag>()
int spanListCount = spanList.Count;
}
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration