paypal/SeLion

Please help me to disable persistant hover in internet explorer driver.

Closed this issue · 10 comments

Please find the below code, still i am see the persistent hover is enabled in the driver info. Please check and revert.

public void browserCheck(){
    String browserName=Config.getConfigProperty(ConfigProperty.BROWSER.getName());
     System.setProperty(ExcelReport.ENABLE_EXCEL_REPORTER_LISTENER, "true");
    if (browserName.equalsIgnoreCase("*iexplore")){
        capab = DesiredCapabilities.internetExplorer();
        capab.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,false);
        capab.setCapability(InternetExplorerDriver.NATIVE_EVENTS,false);

                        }
    System.out.println("Running Test On Browser : "+Config.getConfigProperty(ConfigProperty.BROWSER.getName()));

}

public void CXOLogin() throws IOException, InterruptedException {

    cxloginPage = new CortexLoginPage();
    dbcxologinPage = new DBCortexLoginPage();
    cxoHomePage = new CortexHomePage();
    Properties prop = new Properties();
    InputStream input = null;
    input = new FileInputStream("src/test/resources/Properties/Environment.properties");
    prop.load(input);
    String URL = prop.getProperty("URL");
    System.out.println("URL --> "+URL);

    Grid.driver().get( URL);


    if (URL.contains("TEST7")){  
        Grid.driver().navigate().to("javascript:document.getElementById('overridelink').click()");
        Grid.driver().manage().window().maximize();
        Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT, "20000");
        Grid.driver().manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
    cxloginPage.setUserNameTextFieldValue("novusit");
    cxloginPage.setPasswordTextFieldValue("novusit1");
    cxloginPage.clickLoginButton();
    Grid.driver().navigate().to("javascript:document.getElementById('overridelink').click()");
    }

public void CXOAdminTestwithData(userMaintenanceDAO usrMaintnceData)
throws Exception {

    CortexCommonWorkflows cxoCommonWorkflows = new CortexCommonWorkflows();     
    cxoCommonWorkflows.CXOLogin();
    Thread.sleep(2000);

    UserMaintenanceWorkflows.Addusrmaint(usrMaintnceData);

}

Can you please add the version of IE and IEDriver you are using here.

I am using IE - 9 and the IEDriver Version s 2.53.0
Note: we have also tried the same IEDriver with IE11 as well. Still the mouse hovering issue exist, even when try to disable the enable persitant hover, we are getting it as true in driver info in the console logs. Please check and revert

mach6 commented

Grid.driver() returns / provides access to the raw webdriver api's

Therefore, this feels very much like a selenium issue/concern not a SeLion one.
Have you searched / reached out to the standard Selenium support channels?

The above doesn't really fully demonstrate how you are updating the desired capabilities to set ENABLE_PERSISTENT_HOVERING to "false" etc.

Please consult this page
http://paypal.github.io/SeLion/html/documentation.html#additional-selenium-caps
and provide more detail on how you are setting these additional capabilities

public class CXOAdminFunctionalTest {

@Test(dataProvider = "userMaintainanceData", testName="User Maintenance")
@WebTest (additionalCapabilities = {"ENABLE_PERSISTENT_HOVERING:false","NATIVE_EVENTS:false","REQUIRE_WINDOW_FOCUS:true"})
public void CXOAdminTestwithData(userMaintenanceDAO usrMaintnceData)
        throws Exception {


    //CortexCommonWorkflows cxoCommonWorkflows = new CortexCommonWorkflows();       

    SeLionAsserts.verifyEquals(Grid.getWebTestSession().getAdditionalCapabilities().getCapability("ENABLE_PERSISTENT_HOVERING"), Boolean.FALSE);
    SeLionAsserts.verifyEquals(Grid.getWebTestSession().getAdditionalCapabilities().getCapability("NATIVE_EVENTS"), Boolean.FALSE);
    SeLionAsserts.verifyEquals(Grid.getWebTestSession().getAdditionalCapabilities().getCapability("REQUIRE_WINDOW_FOCUS"), Boolean.TRUE);
    CortexCommonWorkflows.CXOLogin();
            Thread.sleep(2000);

    ItemMaintenanceworkflows.Addacitem(usrMaintnceData);

}

We have passed and verified through Selion Asserts, falgs are set, But the in the console we hvae driver info record which the below values, still the hover is not working fine.

Console:
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'UK-BI-VM-WS015', ip: '10.166.42.94', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_20'
Driver info: driver.version: RemoteWebDriver

Mouse Hover code:
public static void Additemdes(userMaintenanceDAO usData) throws InterruptedException, IOException {
cxoHomePage = new CxoHomePage();
adminpage = new adminPage();
itemdesdet = new ItemDescriptionDetail();
itemdessrc = new ItemDescriptionSearchPage();
adminpage.getAdminLink().hover();
adminpage.getUsermenuMaintenanceLink().hover();
adminpage.getItemdescrLink().hover();
adminpage.getItemdescraddLink().hover();
adminpage.getItemdescraddLink().click();
}

when i have tried with driver instaed of grid.driver(), its working fine. we are getting this hovering issue only when we use selion grid.

mach6 commented

@SridharDayalan1986 Will you please provide the working example so we can look into this at greater detail?

Hi please find below the working example.

public class CortexOnline {
private static final WebDriver webdriver = null;
private static InternetExplorerDriver driver;
static String driverPath = "C:/Users/e3017984/Downloads/";

@BeforeTest
public static void login() {
    //driver = new FirefoxDriver();

    System.setProperty("webdriver.ie.driver", driverPath+"IEDriverServer.exe");
    DesiredCapabilities capab = DesiredCapabilities.internetExplorer();
    capab.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,false);
    capab.setCapability(InternetExplorerDriver.NATIVE_EVENTS,false);
    driver = new InternetExplorerDriver(capab);
    driver.manage().window().maximize();
    driver.get("http://ukmvwebsrvlx03.metavanteuk.pri:9030/CortexOnline-TEST66WASORA/logon.do");
    driver.findElement(By.name("j_username")).clear();
    driver.findElement(By.name("j_username")).sendKeys("docs");
    driver.findElement(By.name("j_password")).clear();
    driver.findElement(By.name("j_password")).sendKeys("docs12345");
    driver.findElement(By.xpath("//input[@value='Submit']")).click();

}

@AfterTest
public static void logout(){
driver.findElement(By.linkText("logout")).click();
driver.close();
}
@test
@webtest
public static void browserTest() {

    driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
    UserMaintenance.mouseOverAdminLink(driver);
    System.out.println("Admin Link");
    UserMaintenance.mouseOverUsrmenumaintLink(driver);
    System.out.println("User/USer Maintenance");
    UserMaintenance.mouseOverUsrmaintLink(driver);
    System.out.println("User Maintenances");
    UserMaintenance.ClickUsrmaintaddLink(driver);
    usrmaintdet.Addusrmaint(driver);

    // Search Update & Delete
    UserMaintenance.mouseOverAdminLink(driver);
    UserMaintenance.mouseOverUsrmenumaintLink(driver);
    UserMaintenance.mouseOverUsrmaintLink(driver);
    UserMaintenance.ClickUsrmaintsearchLink(driver);
    //usrmaintdet.Updateanddeleteusrmaint(driver);


}

}

Mouse Over Function:
ublic class UserMaintenance {

public static void mouseOverAdminLink(InternetExplorerDriver driver) {
/*  Grid.selenium().mouseOver("link=Case Management");
    driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
    Actions actions = new Actions(driver);
    WebElement mainMenu = driver.findElement(By.xpath("//div[@id='fismenu']/ul/li[3]/a"));
    //WebElement mainMenu = driver.findElement(ByCssSelector.cssSelector("html body div#fismenu.jqueryslidemenu ul li a"));
    actions.moveToElement(mainMenu);actions.build();
  //  actions.perform();

_/
Actions builder = new Actions(driver);
WebElement tagElement = driver.findElement(By.xpath("//div[@id='fismenu']/ul/li[3]/a"));
System.out.println(tagElement.getText());
builder.moveToElement( tagElement).build().perform();
}
public static void mouseOverUsrmenumaintLink(InternetExplorerDriver driver) {
/_Grid.selenium().mouseOver("link=Case Management");
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
Actions actions = new Actions(driver);
WebElement SubmenuI = driver.findElement(By.xpath("//div[@id='fismenu']/ul/li[3]/ul/li[1]/a"));
//WebElement SubmenuI = driver.findElement(By.linkText("User/Menu Maintenance"));
actions.moveToElement(SubmenuI);
actions.perform();*/
Actions builder = new Actions(driver);
WebElement tagElementI = driver.findElement(By.xpath("//a[contains(text(),'User/Menu Maintenance')]"));
System.out.println(tagElementI.getText());
builder.moveToElement( tagElementI).build().perform();
}
}

mach6 commented

this is almost a year old without any activity. closing it