简体   繁体   中英

Selenium moveToElement twice and then click on element is not working

There is an element on which I need to click after mouseover on two elements ie mouseover on Element1-> mouseover on Element2-> click on Element3.

Below is my code:

Actions actions = new Actions(driver);
actions.moveToElement(billingBtn).build().perform();
actions.moveToElement(billingconfigurationBtn).build().perform();
actions.moveToElement(billingcyclemanagementBtn).click().build().perform();

This is not working for me. It executes so fast, then it is able to perform only 1st step.

Please help!

If the Hover over event on Element 2 depends on appearance of Some Element which appears after Mouse over on Element 1 then the Mouse over action on Element 1 and in next statement Mouse over element on Element 2 might not be able to detect if the mouse was hovered over the Element 1 or not as it is executing fast

try to do
Mouse Over Element 1
Webdriver wait for some element appearing after hover on Element 1
Mouse Over Element 2
Webdriver wait for some element appearing after hover on Element 2
Click on the desired element

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM