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

后端 未结 4 614
轮回少年
轮回少年 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:07

    You need to use - using OpenQA.Selenium.Interactions;

    0 讨论(0)
  • 2021-02-02 12:13

    yeah the question you posted is about tool tip

    perform mouse hover the then capture its attribute value

    closely observe your HTML code manually move your mouse pointer on the element & observe in which attribute value your hidden text present

    Actions builder = new Actions(driver)
    builder.MoveToElement(driver.FindElement(By.Id("Content_AdvertiserMenu1_LeadsBtn")))
           .Click().Build().Perform();
    
    
    String value=driver.FindElement(By.Id("Content_AdvertiserMenu1_LeadsBtn")).getAttribute("attribute value in which hidden text presents");
    
    0 讨论(0)
  • 2021-02-02 12:26

    Just wanted to mention that a last resort workaround could be to try javascript mouse over simulation.

    Solutions for that in various languages are posted here: http://code.google.com/p/selenium/issues/detail?id=2067

    0 讨论(0)
  • 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();
    
    0 讨论(0)
提交回复
热议问题