Search code examples
javascriptselenium-ideinvalid-url

Selenium IDE - checking for a 404 error


Im trying to check if a url entered into the target field for the command "checkUrl" is valid or not using javascript, but i keep getting an error. There are multiple pages listed within the sites I'm testing and I have the need to verify if the pages have been added with the correct name, or even at all using the relative url.

Selenium.prototype.doCheckUrl = function(locator){
var request = new XMLHttpRequest();  

request.open('GET', locator, true);  
request.send();  

if (request.status === "404") {  
request.message = false ;

} 
}

Solution

  • It doesn't seem to exists a simple answer. You can take a look at the following answers:

    Ektor