Wednesday 30 May 2018

IE mouse hover on drop down

Mouse hovering works like butter on chrome and firefox but when it comes to IE it doesn't. I faced issue with navigating multiple sub menu's (here 2 level depth). Issue was I mouse hover on main menu which displays sub menu and again hover on it which displays another one and then click one of them based on a condition.

What I tried:
1. With Action Class -> nested hovering (moveToElement().moveToElement()) -> No luck
2. With Action Class -> partial hovering (moveToElement()) next command click -> Intermittent success
3. Thread pool -> 2 separate threads one listening for sub menu visibility and another clicks on menu ->  Intermittent success

What Finally Worked:
 String hover= "if(document.createEvent){var evObj = document.createEvent('MouseEvents');evObj.initEvent('mouseover',true, false); arguments[0].dispatchEvent(evObj);} else if(document.createEventObject) { arguments[0].fireEvent('onmouseover');}";
         ((JavascriptExecutor) getDriver()).executeScript(hover,getDriver().findElement(By.xpath("")));
         ((JavascriptExecutor) getDriver()).executeScript(hover,getDriver().findElement(By.xpath("")));
       

1 comment:

  1. Casinos near me - Mapyro
    Casino Finder 용인 출장마사지 - Find casinos and other gaming near 군산 출장안마 you from 창원 출장안마 3475 Las Vegas Blvd S, Las 안동 출장샵 Vegas, NV 89109. Casinos Near Me - Find Casinos Near 서울특별 출장마사지 Me.

    ReplyDelete