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

前端 未结 6 2019
自闭症患者
自闭症患者 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:20

    My case we had a table of rows, if mouse over on the row, one of the column(td) should display some 4 icons, we should click on it.

    Action action=new Action(driver);
    action.moveToElement(hoverElt).clickAndHold().build().perform();
    

    It worked for me. moveToELement() move your control to the element

    clickAndHold() clicks and holds the hovered element, so that its easy for us to do operation on visible elements.

提交回复
热议问题