Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98814

Unable to locate element error in selenium webdriver node.js

$
0
0

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);
    }

Viewing all articles
Browse latest Browse all 98814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>