Issue
Using CSS/JS one can change the cursor that the user sees for their mouse pointer. For instance, you can set cursor: wait
to change the cursor in to a spinner.
What I would like to do is have a Selenium test which waits until the cursor changes to/from wait
. However, I can't find any "expected condition" (EC) method for watching the CSS value of the cursor.
Is there any way to wait for a cursor change (short of just sleeping and periodically checking its value)?
Solution
Theoretically, I believe you can wait until element.GetCssValue("cursor") == "wait"
. It would be great that you can provide a demo page to test it.
Expected conditions (EC) were created for common wait.Until
usages, while waiting for cursor seems rare.
Sample code in C#:
// depends on which element you want to wait, here take <body> as an example
var wait = new WebDriverWait(driver, TimeSpan.FromMilliseconds(5000));
wait.Until(d => d.FindElement(By.TagName("body")).GetCssValue("cursor") == "wait");
Answered By - Yi Zeng
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.