如何在Selenium Webdriver中移动光标 [英] How to move cursor in Selenium Webdriver
本文介绍了如何在Selenium Webdriver中移动光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,我已经通过jquery小部件检查了代码及其呈现.
okay, i have checked the code and its rendering out by a jquery widget.
END
我正在尝试将光标移动到<a \>
,但是问题是直到我将鼠标指针物理地移动到所选图像上时,元素才会呈现.
I am trying to move the cursor to <a \>
, but the problem is that the element is not rendered until i move mouse pointer physically on selected image.
如何移动鼠标悬停在<a \>
上以选择/单击?
How can i move to the mouse to hover over <a \>
to select/click?
FF version 20
Selenium WebDriver version: 2.31.2.0
当前代码
Actions actions = new Actions(driver);
int locationX = Convert.ToInt32(ratingElementDiv[i].Location.X);
int locationY = ratingElementDiv[i].Location.Y;
actions.MoveToElement(WaitForElement(By.CssSelector(starElement)), locationX, locationY).Click().Perform();
我看不到有任何动作...有什么帮助吗?
i dont see any action happening... any help?
推荐答案
操作由3个步骤组成.
- 配置
Actions builder = new Actions(driver);
Point location ratingElementDiv[i].getLocation();
builder.MoveToElement(WaitForElement(By.CssSelector(starElement)), location.X, location.Y).click();
(我不确定点击次数)
- 采取行动
Action selectLink = builder.build();
- 执行
selectLink.perform();
尝试一下,告诉我是否还有问题.
try this and tell me if you still have some problem.
这篇关于如何在Selenium Webdriver中移动光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文