Custom cursors cannot be converted to string

Ask general questions here.
IoanaI
Posts: 1
Joined: Sun Oct 11, 2020 2:04 pm

Custom cursors cannot be converted to string

Post by IoanaI » Sun Oct 11, 2020 2:12 pm

Hello,

I've implemented the following code module WaitForCursorToLoad and I got this error: Custom cursors cannot be converted to string.

public static void WaitForCursorToLoad(int maxLoopDuration)
{
// store the current state of the cursor into a string variable
string currentState = Mouse.Cursor.ToString();

// Starts measuring the elapsed time
System.Diagnostics.Stopwatch newWatch = System.Diagnostics.Stopwatch.StartNew();

do {

// store the current state
currentState = Mouse.Cursor.ToString();

// Add a report info with the current state
Report.Info(currentState);
}
while (currentState == "[Cursor: WaitCursor]" && newWatch.Elapsed.Seconds <= maxLoopDuration);


// If you want the test to fail after maxLoopDuration:
if(newWatch.Elapsed.Seconds > maxLoopDuration)
{
Ranorex.Report.Error("Application still reports busy state after exceeding the allotted time (maxLoopDuration)");
}

}

Can anyone help me with this? :D

Thank you!

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

Re: Custom cursors cannot be converted to string

Post by odklizec » Wed Oct 14, 2020 6:46 am

Hi,

I think you will have to look for answer here:
https://stackoverflow.com/questions/172 ... e-converti
Simply put, it's just like that for custom cursors and you will have to use a different approach, to validate custom cursor's state ;)
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