Page 1 of 1

Instead of mouse click

Posted: Tue Dec 08, 2015 10:30 am
by ejji09
Hi,

Am using code module to write my script and when i run my script, I can see that my test run shows me the mouse cursor and clicks on the buttons. But i dont want to do like i want to run my script with my the cursor where the cursor dosent have to move to perform the actions.
my code ex:

Code: Select all

            var repo = TestRis_iRepository.Instance;
            var username = repo.LogIn.Username;
            username.Click();
            username.PressKeys("test);
            var password = repo.LogIn.Password;
            password.Click();
            password.PressKeys("test);
            var logIn = repo.LogIn.LogIn;
            logIn.Click();
Am using the above code where whenever i run this the mouse cursor will move and clicks on the appropriate buttons. How can i write a code where it should use the cursor to perform the actions.

Thankyou.

Re: Instead of mouse click

Posted: Tue Dec 08, 2015 10:33 am
by odklizec
Hi,

You can use PerformClick() instead of Click() method. PerformClick simply clicks the element without moving the mouse.

Re: Instead of mouse click

Posted: Tue Dec 08, 2015 11:01 am
by ejji09
I cannot find PerformClick() method ?

Re: Instead of mouse click

Posted: Tue Dec 08, 2015 12:38 pm
by odklizec
You can find it (briefly) described in Ranorex API and discussed many times at forum...
http://www.ranorex.com/search.html?q=performclick
It may be possible that your element in question simply does not support PerformClick? Track the element with spy and examine the list of available actions. For example, elements like 'button' typically offer 'Press' action.
element_actions.png

Re: Instead of mouse click

Posted: Tue Dec 08, 2015 1:08 pm
by ejji09
I cannot use PerformClick() method to my login button but i can use Click() method, andits use cursor to click the button.. So am using Press() method which presses the button with out any use of cursor. Thank you odklizec