How to Hover over and click on an invisible element using selenium webdriver?

前端 未结 6 2074
自闭症患者
自闭症患者 2021-02-02 17:43

There is an invisible element on my HTML page which becomes visible when a mouse hover is done on the element. What I Have to do is

  1. Hover over the element
  2. <
6条回答
  •  忘了有多久
    2021-02-02 18:15

    Your Actions builder looks slightly wrong to me. Here is a example I use:

    public static void mouseClickByLocator( String locator ) {    
      WebElement el = driver.findElement( By.cssSelector( locator ) );    
      Actions builder = new Actions(driver);    
      builder.moveToElement( el ).click( el );    
      builder.perform();    
    }
    

提交回复
热议问题