Hello all,
I need to validate in my scipts that the mouse pointer changes to a doubled arrow by moving over a special point.
Is there a possibility for that?
Best Regards,
Anett
Validation of the mouse
Validation of the mouse
Last edited by Anett on Tue Feb 05, 2019 7:49 am, edited 1 time in total.
Re: Validation of the mouse
Hi Anett,
There is no built-in way to achieve what you want, so you will most probably have to create some code for this. For evaluating mouse pointer, you can use Mouse.CursorName, which should return name of actually used cursor.
There is no built-in way to achieve what you want, so you will most probably have to create some code for this. For evaluating mouse pointer, you can use Mouse.CursorName, which should return name of actually used cursor.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Validation of the mouse
I did that once and my code (which works surprisingly well) looks like this (pSeconds is the amount of seconds that I am willing to wait.):
string currentState = Mouse.Cursor.ToString(); System.Diagnostics.Stopwatch newWatch = System.Diagnostics.Stopwatch.StartNew(); while (currentState.ToLower().Contains("waitcursor") && newWatch.Elapsed.Seconds <= pSeconds){ Thread.Sleep(1000); currentState = Mouse.Cursor.ToString(); //Ranorex.Report.Debug("waitForSavingDone(): currentState=" + currentState + ". newWatch.Elapsed.Seconds:" + newWatch.Elapsed.Seconds + "; pSeconds:" + pSeconds); } if(newWatch.Elapsed.Seconds > pSeconds){ //Ranorex.Report.Error("Mauszeiger zeigt nach Ablauf von " + pSeconds.ToString() + " Sekunden immer noch 'Speichern'."); throw new TimeoutException("Mauszeiger zeigt nach Ablauf von " + pSeconds.ToString() + " Sekunden immer noch 'Speichern' - Timeout."); }else{ Ranorex.Report.Info("Mauszeiger gibt keinen Hinweis (mehr) auf 'Speichern'-Vorgang."); }
Vorsprung durch Wahnsinn
www.Doktor-Andy.de
www.Doktor-Andy.de
Re: Validation of the mouse
I wrote some code to validate the mouse cursor. It was useful in verifying that I'd calculated the correct position for the mouse in our AUT.
I look at Mouse.CursorName first. This works great with system cursors.
But in our case it might be something like "Custom123456" if it's a mouse cursor image of our own. If that's the case then I Ranorex.Imaging.Load() an image of the mouse cursor that I previously saved via Mouse.GetCursorImage(). And then I Ranorex.Imaging.Compare() that loaded image with the current cursor image, via Mouse.GetCursorImage() again.
I look at Mouse.CursorName first. This works great with system cursors.
But in our case it might be something like "Custom123456" if it's a mouse cursor image of our own. If that's the case then I Ranorex.Imaging.Load() an image of the mouse cursor that I previously saved via Mouse.GetCursorImage(). And then I Ranorex.Imaging.Compare() that loaded image with the current cursor image, via Mouse.GetCursorImage() again.
Re: Validation of the mouse
Thank you very much!!!!
Validating the CursorName is the way we will do it.
Thank you everybody!
Validating the CursorName is the way we will do it.
Thank you everybody!