The HTML
code I'm dealing with includes this element:
<a style="text-decoration:none; font-weight:normal;" href="javascript:void(0);" onclick="CreateNewServiceItemApproved();">
<img src="icons/ui/addnew.png">
<span style="color:#000">Add New Incident</span>
</a>
I am trying to click on it but keep getting the error message:
org.openqa.selenium.NoSuchElementException: Unable to find element
I've attempted to locate it using these commands:
driver.findElement(By.xpath("a[@onclick='CreateNewServiceItemApproved()']")).click();
driver.findElement(By.xpath("//span[contains(text(),'Add New Incident')]"));
Why am I unable to locate this element?
What is causing this issue?