I am new to automated testing. I am using C#, Selenium and Chrome 99 with the correct driver. I am trying to get to an anchor tag on the page.
Here is my code that is not working,
driver.Url = "abc.com"; //cant display the real one
driver.FindElement(By.XPath("//a[@href='ubEntryQueue.aspx']")).Click();
The error I am getting:
OpenQA.Selenium.NoSuchElementException
HResult=0x80131500
Message=no such element: Unable to locate element: {"method":"xpath","selector":"/a[@href='ubEntryQueue.aspx']"}
(Session info: chrome=99.0.4844.74)
Source=WebDriver
StackTrace:
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.FindElement(String mechanism, String value)
at OpenQA.Selenium.By.<.ctor>b__11_0(ISearchContext context)
at OpenQA.Selenium.By.FindElement(ISearchContext context)
at OpenQA.Selenium.WebDriver.FindElement(By by)
at CLQTesting.WQ.ValidateWQDisplays() in C:\QA\CLQTesting\WQ.cs:line 30
This was my last attempt
driver.FindElement
call and run in debug mode? Specifically, is the link visible on the browser screen? It looks like there are parent elements of the link that are set not to display - this will hide all child elements so Selenium would be unable to find them.