Page 1 of 1

How to click the button?

Posted: Wed Sep 09, 2009 5:59 pm
by AlexDozer
Hi,

I'm new to Ranorex and also to C# but I have experience with C, C++ and Java. But I'm not be able to solve my little problem.

All I want is to press the Refresh-Button in Firefox. That's all. Here is a picture from my Repository.Image

So, I tried this Code like in the User-Guide:

Code: Select all

NewRepository.Hartgeld.Buttons.NeuLaden.Click();
But I got the Error CS0120 "An object reference is required for the nonstatic field, method, or property 'member'". So I tried this:

Code: Select all

Ranorex.Button button = NewRepository.Hartgeld.Buttons.NeuLaden;
button.Click();
Still the same :( Next try:

Code: Select all

try
{
      	Program meins = new Program();
       	meins.start();
}
            ...
public void start()
{
      	Ranorex.Button button = NewRepository.Hartgeld.Buttons.NeuLaden;
        button.Click();
            
}
Still the same :cry: Can anyone help me?


Regards, Alex

Re: How to click the button?

Posted: Wed Sep 09, 2009 6:24 pm
by Support Team
You have to instantiate the repository, like:
NewRepository myRepo = new NewRepository();
myRepo.Hartgeld.Buttons.NeuLaden.Click()
Just look at the code the Ranorex Recorder generates, it should look similar.

Regards,
Alex
Ranorex Support Team

Re: How to click the button?

Posted: Wed Sep 09, 2009 7:42 pm
by AlexDozer
Thank you!