首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MouseClick未在FirefoxDriver上注册

MouseClick未在FirefoxDriver上注册
EN

Stack Overflow用户
提问于 2014-10-15 16:54:31
回答 1查看 90关注 0票数 0

我试图点击“查看用户”,但出于某种原因,它适用于Chrome,而不是firefox。

代码语言:javascript
复制
//this clicks on the Admin tasks on the top. 
driver.findElement(By.id("x-auto-34")).click();
//moves mouse over user profile management under the drop down menu for admin task
actions.moveToElement(driver.findElement(By.id("UserProfileManagement"))).build().perform();
//finds user configuration and clicks.
    driver.findElement(By.id("ViewUsers")).click();

我也用xpath尝试过,但是只有firefox遇到了同样的问题。

当我运行它时,它不会发现任何异常或其他任何元素。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-15 19:27:25

在开发Selenium自动化时,我经常会遇到这种情况。有时,在WebElement上执行的操作不能正常工作。当Selenium click方法不起作用时,我使用Javascript解决方案执行单击:

代码语言:javascript
复制
WebElement element = driver.findElement(By.id("ViewUsers"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26387938

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档