How to do a mouse over using selenium webdriver to see the hidden menu without performing any mouse clicks?

后端 未结 4 620
轮回少年
轮回少年 2021-02-02 11:56

How to do a mouse hover/over using selenium webdriver to see the hidden menu without performing any mouse clicks?

There is a hidden menu on website which i am testing th

4条回答
  •  一生所求
    2021-02-02 12:29

    Try this?

    // this makes sure the element is visible before you try to do anything
    // for slow loading pages
    WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
    var element = wait.Until(ExpectedConditions.ElementIsVisible(By.Id(elementId)));
    
    Actions action  = new Actions(driver);
    action.MoveToElement(element).Perform();
    

提交回复
热议问题