Ask general questions here.
-
irem
- Posts: 11
- Joined: Fri May 25, 2012 12:40 pm
Post
by irem » Tue May 29, 2012 8:24 am
Hello,
I would like to access a repository item name with user code. How can I get a slider's repository item name ?
My code is here :
Code: Select all
var sliders = repo.FormMedia_Player.FormMedia_Player.FindChildren<Slider>();
for(int i = 0; i < sliders.Count; i++)
{
Report.Info(string.Format("Slider Name : {0} ", sliders[i].NAME????????? ));
}
Thanks in advance.
-
Support Team
- Site Admin

- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
-
Contact:
Post
by Support Team » Tue May 29, 2012 2:09 pm
Hi,
You can use the following code to get a specific Attribute of the element:
IList<Slider> sliders = repo.YourForm.Self.FindChildren<Slider>();
foreach(Slider slider in sliders){
Report.Info("Name of the Slider: "+slider.Element.GetAttributeValue("Name of the Attribute"));
}
Regards,
Markus
Ranorex Support Team
-
irem
- Posts: 11
- Joined: Fri May 25, 2012 12:40 pm
Post
by irem » Mon Jun 04, 2012 6:48 am
Hi Markus,
I can't use your solution because I need the repository item name. So I don't know GetAttributeValue's parameter ("Name of the Attribute") ?
Thanks.
Last edited by
irem on Wed Jun 06, 2012 6:47 am, edited 1 time in total.
-
Support Team
- Site Admin

- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
-
Contact:
Post
by Support Team » Tue Jun 05, 2012 3:53 pm
Hi Irem,
I am sorry but I can't follow you, what do you exactly mean with "also need the repository item name"?
Do you not know the names of your repository items or do you not know the name of the attributes?
If you just don't know the name of the attributes you can use Spy to identify it.
Regards,
Markus
Ranorex Support Team
-
irem
- Posts: 11
- Joined: Fri May 25, 2012 12:40 pm
Post
by irem » Wed Jun 06, 2012 7:05 am
Hi Markus,
I will explain more clearly. There are five sliders on form (volume slider, progress slider etc.). However, I would like to access a specific slider's value by this way :
Code: Select all
var sliders = repo.FormMedia_Player.FormMedia_Player.FindChildren<Slider>();
double volumeSliderValue;
for(int i = 0; i < sliders.Count; i++)
{
// I would like to get slider's repository item name
// because I need only volume slider's value :
if ( sliders[i].Name == "VolumeSlider")
volumeSliderValue =sliders[i].Value;
}
Thanks,
Irem
-
Support Team
- Site Admin

- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
-
Contact:
Post
by Support Team » Wed Jun 06, 2012 11:41 am
Hi,
can you provide us a snapshot of your application under test holding all of your sliders.
With having this information it's easier to help you finding a solution for sour issue.
Follwoing chapter of our user guide will explain how to generate a snapshot file:
http://www.ranorex.com/support/user-gui ... files.html
Regards,
Tobias
Ranorex Team