I need to keep both UI Grid rows selected in order for a right click customised menu to show up. If only one row is selected a different context menu is displayed so I need to keep both rows selected.

Any ideas how to do this?

Code below is what I have tried. Trouble is with this code, even though both rows are selected, the right click only happens for one row (effectively de-selecting one of the rows)

See code below

class Program
{
    static void Main(string[] args)
    {
        IWebElement tableElement;

        String _address = "https://datatables.net/examples/api/select_row.html";

        IWebDriver _driver = new ChromeDriver();

        _driver.Navigate().GoToUrl(_address);
        tableElement = _driver.FindElement(By.Id("example"));

        Actions actions = new Actions(_driver);

        var noRows = _driver.FindElements(By.XPath("//table[@id='example']/tbody/tr"));

        for (int i = 0; i < 2; i++)
        {
            noRows[0].Click();  

            actions.KeyDown(Keys.Control).Click(noRows[1]).KeyUp(Keys.Control).Perform();

            actions.ContextClick(noRows).Perform();
        }
    }
}    

0 Answers