Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
524 views
by
retagged by
Do anyone know any tool in which we get broken links of the site but the site has authentication ie username and password?

I tried with Xenu, Link checker but that does not work.
by Contributing Tester (52 points)
Xenu link checker tool. It is open source and free tool.

4 Answers

1 like 0 dislike
by Contributing Tester (52 points)
https://en.softonic.com/download/xenus-link-sleuth/windows

This is Xenu link checker tool. easy and effective tool.
0 like 0 dislike
by
Have you tried

https://www.screamingfrog.co.uk/seo-spider/

Screaming Frog SEO Spider? That lets you find broken link.
0 like 0 dislike
by
Most websites have about 15% affiliate links that have some issue which causes loss of revenue. Most of these issues pertain to, but are not limited to:
1. Affiliate links without tags or with incorrect tags: Often when you buy an affiliate website, either there is an error in moving and we notice that a few links keep pointing to the previous owner.
2. Amazon pages with 404 error (product page moved): Amazon keeps moving product pages every now and then. This results in pages becoming 404.
3. Items that are out of stock (oos) and unavailable to buy: If the product is not available, you lose the opportunity to make money on the purchase.
4. Items whose ratings have dropped now: Over time, product quality changes and so do their ratings. What was once a 5-star item, is now a 2-star item. When you recommend such an item, your users think your website is a scam.
While these issues seem trivial, they are more common than you think. And all of that is easy money, you really don't have to do much except for fixing these links.
When you sign up with NotifyOk, we scan your website and inform you of any issues with your affiliate links. All it takes is 5 minutes to set up, and then you can sit back and get back your lost revenue!
Take a free trial at: https://notifyok.com/
0 like 1 dislike
by Expert (748 points)
I have  done broker link in selenium web driver and find all link which are broken and also get http codes
by Expert (572 points)
Can you provide little more idea of how you did that?
by Expert (748 points)
package selenium;

import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class FindBrokenLinkExample {
   
    private WebDriver driver;
    private int invalidLinksCount;

    @BeforeClass
    public void setUp() {
        System.setProperty("webdriver.firefox.marionette","E://Users//Bharat Varshney//workspace//drivers//geckodriver.exe");
        driver = new FirefoxDriver();
        driver.manage().window().maximize();
        driver.get("http://google.com");
    }

    @Test
    public void validateInvalidLinks() {

        try {
            invalidLinksCount = 0;
            List<WebElement> anchorTagsList = driver.findElements(By .tagName("a"));
                   
            System.out.println("Total no. of links are "+ anchorTagsList.size());
                   
            for (WebElement anchorTagElement : anchorTagsList) {
                if (anchorTagElement != null) {
                    String url = anchorTagElement.getAttribute("href");
                    if (url != null && !url.contains("javascript"))
                    {
                        verifyURLStatus(url);
                       
                    } else
                    {
                       
                        invalidLinksCount++;
                    }
                }
            }

            System.out.println("Total no. of invalid links are " + invalidLinksCount);
                   

        } catch (Exception e)
        {
            e.printStackTrace();
            System.out.println(e.getMessage());
        }
    }

    @AfterClass
    public void tearDown() {
        if (driver != null)
            driver.quit();
    }

    public void verifyURLStatus(String URL) {

        HttpClient client = HttpClientBuilder.create().build();
        HttpGet request = new HttpGet(URL);
        try {
            HttpResponse response = client.execute(request);
            // verifying response code and The HttpStatus should be 200 if not,
            // increment invalid link count
            ////We can also check for 404 status code like response.getStatusLine().getStatusCode() == 404
            if (response.getStatusLine().getStatusCode() != 200)
                invalidLinksCount++;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...