0

Trying to simply click on a textbox but get an OpenQA.Selenium.NoSuchElementException error. I've tried all possible combinations of using ids, cssSelectors, xPath, but got no luck. I also added different wait times and different implicit wait and explicit wait, however, it didn't solve the problem.

I get the OpenQA.Selenium.NoSuchElementException right when I am waiting for the element to be visible.

Here is my code:

    //Open URL of Service Now
    driver.Url = "https://-------.service-now.com/"; //censored
    System.Threading.Thread.Sleep(5000);

    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
    WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
    wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#user_name")));
    wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#user_name")));
    driver.FindElement(By.CssSelector("#user_name")).Click();

Here is an image of the CSS: Image of CSS

Yehudah
  • 65
  • 1
  • 5

0 Answers0