将鼠标光标悬停在Selenium中的链接上时,检查鼠标光标是否变为手形?

时间:2017-07-18 16:29:54

标签: java selenium

在Java中使用Selenium时,有没有办法检测鼠标指针是否变为手指/指针?

1 个答案:

答案 0 :(得分:2)

您可以等待指针的css值更改。

// 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") == "pointer");

原帖:Selenium: How can I wait until the cursor changes?