Perform Click Event using Selenium in SpreadJS

Posted by: jothivignesh.c on 24 September 2019, 11:50 am EST

  • Posted 24 September 2019, 11:50 am EST

    Hi Team,

    Is there any way to perform double click on a particular cell using (row,index) in SpreadJS using Selenium.

    Thanks,

    Jothi.

  • Posted 25 September 2019, 3:15 am EST

    Hi Jothi,

    If you need to perform double click to just edit the cell, then you use the startEdit() method to start editing a cell.

    For performing the actual click you could follow the following steps:

    • bring cell in view using the showCell method

    driver.executeScript("window.testSpread.getActiveSheet().showCell(arguments[0], arguments[1])", rowIndex, columnIndex);
    

    • get x,y coordinates of the cell

    ArrayList<int> rectArr = (ArrayList<int>) driver.executeScript("var cellRect = window.testSpread.getActiveSheet().getCellRect(arguments[0], arguments[1]); return [cellRect.x, cellRect.y]", rowIndex, colIndex);
    

    • perform click at the x, y position

    WebElement host = driver.FindElement(By.Id("spreadID"));
    Actions action = new Action(driver);
    action.moveToElement(host, rectArr.get(0), rectArr.get(1)).doubleClick ().build().perform();
    

    Regards

    Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels