I have put an if else
condition in selenium webdriver node.js to check if a string contains an "Add New" string, but I am getting the error Unable to locate element: // *[contains(text(),'Add New')]
Here is the code:
if (driver.findElement(By.xpath("// *[contains(text(),'Add New')]"))) {
reject(new Error("This is an error"));
} else {
resolve(true);
}