【问题标题】:Mousehover is not working in IE using Selenium WebDriverMousehover 在使用 Selenium WebDriver 的 IE 中不起作用
【发布时间】:2016-02-15 08:40:40
【问题描述】:

我已使用以下代码将鼠标悬停在选项卡中并选择表中的菜单。 鼠标悬停在 Firefox 上运行良好,但在 Chrome 和 Internet Explorer 上无法运行。 在选择菜单之前,我们已经选择了 iframe。 请建议在 IE WebDriver 中处理鼠标悬停的替代方法 我已使用操作方法进行鼠标悬停。

action = new Actions(driver); 
action.moveToElement(landingpage).perform(); 
landingpage.click(); 
System.out.println(" menu tab is clicked on FF" ); driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS); 
WebElement tabLinkff = driver.findElement(By.xpath(".//*[@id='mainmenu.service']/li/ul[1]/li/ul[3]/li[2‌​]/a")); 

if(tabLinkff.isEnabled()) { 
    System.out.println("work corner is identified"); 
    tabLinkff.click();
}

【问题讨论】:

  • 以正确的方式编辑您的问题:仅对您的代码使用code sample编辑
  • 你用的代码在哪里?
  • action = new Actions(driver); action.moveToElement(landingpage).perform();登陆页面.click(); System.out.println("菜单选项卡在FF上被点击"); driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS); WebElement tabLinkff = driver.findElement(By.xpath(".//*[@id='mainmenu.service']/li/ul[1]/li/ul[3]/li[2]/a")) ; if(tabLinkff.isEnabled()) { System.out.println("工作角已识别"); tabLinkff.click();}
  • 从 cmets 添加代码,格式化。

标签: selenium


【解决方案1】:

因为您在使用 mousehover 之前使用的是 <iframe>。 您是否使用mousehover 操作所进行的driver.switchTo().defaultContent() 方法回到主窗口?

【讨论】:

  • 是的。我已经使用 driver.switchTo().defaultContent() 注释切换了默认内容。即使我切换了默认内容,在 IE 中也会出现闪烁。请让我知道我知道使用隐式等待找出元素
猜你喜欢
  • 2021-11-21
  • 2013-10-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-25
  • 2012-04-22
  • 2015-07-20
  • 2014-09-30
相关资源
最近更新 更多