Instead of mouse click

Ask general questions here.
ejji09
Posts: 54
Joined: Thu Sep 10, 2015 2:48 pm

Instead of mouse click

Post by ejji09 » Tue Dec 08, 2015 10:30 am

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.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Instead of mouse click

Post by odklizec » Tue Dec 08, 2015 10:33 am

Hi,

You can use PerformClick() instead of Click() method. PerformClick simply clicks the element without moving the mouse.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

ejji09
Posts: 54
Joined: Thu Sep 10, 2015 2:48 pm

Re: Instead of mouse click

Post by ejji09 » Tue Dec 08, 2015 11:01 am

I cannot find PerformClick() method ?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Instead of mouse click

Post by odklizec » Tue Dec 08, 2015 12:38 pm

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
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

ejji09
Posts: 54
Joined: Thu Sep 10, 2015 2:48 pm

Re: Instead of mouse click

Post by ejji09 » Tue Dec 08, 2015 1:08 pm

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