Mouse moves to top left of screen

Class library usage, coding and language questions.
Optisoft Ltd
Posts: 2
Joined: Fri Oct 11, 2013 8:39 am

Mouse moves to top left of screen

Post by Optisoft Ltd » Fri Oct 11, 2013 8:50 am

Hi

I am trying to run a procedure several times throughout a single test case.

It simply selects a few drop down boxes on a form and saves.

The first time it runs through the procedure everything works perfect. The second time it runs through, however, the mouse simply moves to the top left of the screen and thus the test case fails.

Below is the code I'm using.

var repo = Optisoft_NetRepository.Instance;

Validate.Exists(repo.OptisoftNET.ToDoBase.TxtDescription);

Validate.Attribute(repo.OptisoftNET.ToDoBase.TxtDescription, "Visible", true);

repo.OptisoftNET.PatientsBase.ToDo.MoveTo();
repo.OptisoftNET.PatientsBase.ToDo.Click();
repo.OptisoftNET.PatientsBase.btnTabNew.MoveTo();
repo.OptisoftNET.PatientsBase.btnTabNew.Click();
Key_Sequence_txtAlarm();
Mouse_Click_FirstType();
Mouse_Click_FirstPriority();
repo.OptisoftNET.ToDoBase.TxtDescription.MoveTo();
repo.OptisoftNET.ToDoBase.TxtDescription.Click();
repo.OptisoftNET.ToDoBase.TxtDescription.PressKeys("{LShiftKey down}T{LShiftKey up}est{Space}Alarm on a ToDo");
OptisoftStoredCode.ValidateDuringRecord_btnSave();
repo.OptisoftNET.btnSave.Click();
OptisoftStoredCode.ValidateBeforeRecord_btnSave();
repo.OptisoftNET.btnBack.Click();
Validate.Attribute(repo.OptisoftNET.PatientsBase.SelfInfo, "Visible", "True");


I have added validation into the code to check the 'Exists' and 'Visible' properties of the Combo Boxes I am trying to click but the test case fails on the 'Visible' check. I have therefore tried adding a delay into the procedure just in case the form hasn't had time to load properly but still no joy.

I can only assume that the procedure is trying to use the first instance of the form, which now is not Visible, but do not know how to create a new instance of the form, using the same procedure.

Help!!!!!! :D

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Mouse moves to top left of screen

Post by krstcs » Fri Oct 11, 2013 1:19 pm

Try turning off caching for the items in your repository.

Right-click the item, select Properties. In the "Use Cache" field, set to "False".

See how that works.

It will probably be a bit slower, but Ranorex will now evaluate the XPath every time it encounters that item. With caching on, it only evaluates the item once and then tries to re-use that cached info every time.
Shortcuts usually aren't...

Optisoft Ltd
Posts: 2
Joined: Fri Oct 11, 2013 8:39 am

Re: Mouse moves to top left of screen

Post by Optisoft Ltd » Fri Oct 11, 2013 1:42 pm

Spot on, works a dream.

Thank you for your reply 8) :lol:

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Mouse moves to top left of screen

Post by krstcs » Fri Oct 11, 2013 2:08 pm

Great!

Unfortunately, there is not way to turn caching off globally (see http://www.ranorex.com/forum/disable-ca ... -t878.html), but you can turn it off on the items you are having issues with.

Also, if you are opening, closing, and re-opening an application in the same test, that will cause these kinds of issues because Ranorex will not be able to identify the NEW instance of the app if caching is enabled.

NOTE: As I said in my first post, disabling caching can cause the tests to go MUCH slower because Ranorex has to evaluate the RanoreXPath every time hit needs to find the object. This is why they don't have a global switch.
Shortcuts usually aren't...

benny28
Posts: 34
Joined: Thu May 31, 2012 4:48 pm
Location: London
Contact:

Re: Mouse moves to top left of screen

Post by benny28 » Wed Feb 19, 2014 10:36 am

Hello, I've been noticing this issue creeping into my framework recently and intermittently.
Different machines produce different responses in my application under test, but once I restart my machines I resolves itself temporally.

I am not using Ranorex Studio, I've imported the Ranorex DLL's into my Visual Studio project.
Considering there is an approach to fix this in the R.Studio:

"Try turning off caching for the items in your repository."

How can I do this using direct C# code? Do you have an example please?
Or is there code that can turn off caching globally for me? (Note I am aware of and except the potential increased run time)

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Mouse moves to top left of screen

Post by Support Team » Wed Feb 19, 2014 4:48 pm

Hi benny28,

In order to turn off caching via code please to the following:
RepoItem.UseCache = false;

Regards,
Robert

blackout
Posts: 14
Joined: Thu Mar 14, 2013 10:07 am

Re: Mouse moves to top left of screen

Post by blackout » Tue Jun 09, 2015 6:57 pm

Hi there,

Aware this is quite an old thread, however this is still occurring to myself. There's no longer the option of turning the caching off (in code or in Ranorex Spy) that I can see and thus I have no idea how to resolve this.

Any and all help would be greatly appreciated.

Kind Regards.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Mouse moves to top left of screen

Post by Support Team » Wed Jun 10, 2015 12:05 pm

Hi blackout,

The folder caching still exists and can be disabled by following these steps:
  • • Right click on an App – or Rooted-Folder
    Folder.png
    • Choose properties

    • Set UseCache to false
    UseCache.png
Hope this helps.

Regards,
Robert
You do not have the required permissions to view the files attached to this post.

blackout
Posts: 14
Joined: Thu Mar 14, 2013 10:07 am

Re: Mouse moves to top left of screen

Post by blackout » Wed Jun 10, 2015 1:09 pm

Thanks for that, and my apologies.

In the earlier answers it said to 'Right click the item' within the repo, not the application or rooted folder in question thus I couldn't find the option.

That being said, it appears that I've had this set to 'False' from the get-go, and thus the caching doesn't seem to be the cause of my issue :-/


Kind Regards.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Mouse moves to top left of screen

Post by Support Team » Thu Jun 11, 2015 9:39 am

Hello blackout,

We will need further information in order to analyze your issue. May I ask you to write an email to [email protected]?

Thanks,
Robert