0

Unable to locate the menu item Actions drop down.

Screenshot of Inspector:

enter image description here

// driver.FindElement(By.CssSelector(".actionButtonRoot")).Click();
// driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
// driver.FindElement(By.ClassName("new")).Click();
//driver.FindElement(By.XPath("//span[@ng_string='SDE_ACTIONS']")).Click();
//driver.FindElement(By.XPath("//*[contains(text(),'ACTIONS')]")).Click();
//driver.FindElement(By.XPath("//span[@class='text']")).Click();
//driver.FindElement(By.XPath("//div[@class='actionList']")).Click();
//driver.FindElement(By.XPath("//div[@class='actionButtonRoot']")).Click();
//WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
//wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("(/html/body/div/xrx-grid-advance/xrx-grid-actions/ng-form/div[1]/div[1]"))).Click();
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
var element = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@ClassName='actionButtonRoot']::div")));
//Actions action = new Actions(driver);
//action.MoveToElement(element).Perform();
driver.FindElement(By.XPath("//li//span[text()='SDE_ACTIONS']")).Click();
Thread.Sleep(1000);
SelectElement oSelect = new SelectElement(driver.FindElement(By.XPath("//div[@ClassName='actionButtonRoot']")));
oSelect.SelectByIndex(1);
Console.Write("End Test");
ocrdu
  • 2,172
  • 6
  • 15
  • 22

1 Answers1

0

The desired element is an Angular element so to Click() on the element you have to induce WebDriverWait for the ElementToBeClickable() and you can use either of the following Locator Strategies:

  • CssSelector:

    new WebDriverWait(driver, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("div.actionButtonRoot >span.text[ng-string='SDE-ACTIONS']"))).Click();
    
  • XPath:

    new WebDriverWait(driver, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[@class='actionButtonRoot']/span[@class='text' and text()='Actions']"))).Click();
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352