0

I have spent like 5 hours trying to find the selector for that success message down there , for my Selenium c# test with not luck. My test always fail saying cannot locate the element!!

Any idea what selector I can use???

I have tried xpath, Css, Classname with all the plugins...

public IWebElement alertSuccessfulAlert => WebDriver.FindElement(By.XPath("//div[contains(text(),'Registration is successful')]"));

public IWebElement alertSuccessfulAlert => WebDriver.FindElement(By.CssSelector("body:nth-child(2) my-app:nth-child(1) div.container:nth-child(2) > main.row:nth-child(1)"));

enter image description hereenter image description here

Esteban Balvin
  • 117
  • 3
  • 13

1 Answers1

0

The bubble message Registration is successful is generated through a JavaScript so you have to induce WebDriverWait for the desired ElementToBeClickable() and you can use either of the following Locator Strategies:

  • XPath:

      public IWebElement alertSuccessfulAlert = new WebDriverWait(driver, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[contains(., 'Registration is successful')]")));
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352