Page 1 of 1

Ranorex - Repository Item Names

Posted: Tue May 29, 2012 8:24 am
by irem
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.

Re: Ranorex - Repository Item Names

Posted: Tue May 29, 2012 2:09 pm
by Support Team
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

Re: Ranorex - Repository Item Names

Posted: Mon Jun 04, 2012 6:48 am
by irem
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.

Re: Ranorex - Repository Item Names

Posted: Tue Jun 05, 2012 3:53 pm
by Support Team
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

Re: Ranorex - Repository Item Names

Posted: Wed Jun 06, 2012 7:05 am
by irem
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

Re: Ranorex - Repository Item Names

Posted: Wed Jun 06, 2012 11:41 am
by Support Team
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