How to click the button?

Ask general questions here.
AlexDozer
Posts: 33
Joined: Wed Sep 09, 2009 5:41 pm

How to click the button?

Post by AlexDozer » Wed Sep 09, 2009 5:59 pm

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to click the button?

Post by Support Team » Wed Sep 09, 2009 6:24 pm

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
.
Image

AlexDozer
Posts: 33
Joined: Wed Sep 09, 2009 5:41 pm

Re: How to click the button?

Post by AlexDozer » Wed Sep 09, 2009 7:42 pm

Thank you!