Я поместил условие if else
в selenium webdriver node.js, чтобы проверить, содержит ли строка строку «Добавить новую», но я получаю ошибку Unable to locate element: // *[contains(text(),'Add New')]
Вот код:
if (driver.findElement(By.xpath("// *[contains(text(),'Add New')]"))) {
reject(new Error("This is an error"));
} else {
resolve(true);
}