Search code examples
c#seleniumautomationwebdrivernunittestadapter

Can't able to select a specific list that I want in Selenium + C#


Actually, I wanted to select a specific list that I want inside a container. But I try to write with the code below but it is not reflecting:

Actions actions = new Actions(driver);

IWebElement mainMenu = driver.FindElement(By.XPath("//*[@id='requestItemSFHD-24']"));

actions.MoveToElement(mainMenu).Build().Perform();

actions.MoveToElement(mainMenu).Click();

Can anyone help me with this? Thanks.

enter image description here


Solution

  • Actions actions = new Actions(driver);
    IWebElement mainMenu = driver.FindElement(By.ClassName("requestItem-target"));
    actions.MoveToElement(mainMenu).Build().Perform();
    driver.FindElements(By.ClassName("requestItem-target")).ElementAt(1).Click();