Quantcast

How to Find Broken links in an Application using Selenium Webdriver....?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to Find Broken links in an Application using Selenium Webdriver....?

neeraj bakhtani
Hi,
How can we find broken links or Broken images in an application by using Selenium Webdriver....?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7797fde5-adae-4aab-9c9d-0c1e24d1f4cc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Find Broken links in an Application using Selenium Webdriver....?

unni krishnan pr
Hi,

You can use webdriver to get the "href"  values of all the "a" (hyperlink) elements. Once u have all the links with you, you can use Apache Http Client to sent a "get" request through code. By checking the response code (whether it is a 200 or not), you can say whether the link is broken or not.

On Saturday, 14 September 2013 12:22:39 UTC+5:30, neeraj bakhtani wrote:
Hi,
How can we find broken links or Broken images in an application by using Selenium Webdriver....?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/71dfac57-c147-4715-bc7e-cf08a367fc7a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Find Broken links in an Application using Selenium Webdriver....?

Omkar Kolekar
In reply to this post by neeraj bakhtani

    package omkar;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
   
    public class Newbreak {
        public static void main(String[] args) throws InterruptedException, ClientProtocolException, IOException {
              WebDriver driver = new FirefoxDriver();
              driver.manage().window().maximize();
              driver.get("http://www.google.com");
                   
          int size = driver.findElements(By.tagName("a")).size();
          System.out.println(size);
          List<String> Linkarray = new ArrayList<String>();
          List<WebElement> Links = driver.findElements(By.tagName("a"));
         
          for (WebElement image : Links)
          {
                     HttpResponse response = new DefaultHttpClient().execute(new HttpGet(image.getAttribute("href")));
                     String links = image.getText();
                   Linkarray.add(links );
                  
                   Thread.sleep(200);               
                   if (response.getStatusLine().getStatusCode() != 404)
                     
              {
                                   System.out.println("pass"+ links);
              }
                   else if(response.getStatusLine().getStatusCode() == 404 )
              {
                  System.out.println("fail"+ links);
                 
              }
                 
                   }           driver.close();       
            }}

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/17c61527-f0c9-47c1-be42-88134a0fb575%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Find Broken links in an Application using Selenium Webdriver....?

Omkar Kolekar
In reply to this post by unni krishnan pr


How can we find broken links or Broken images in an application by using Selenium Webdriver....?

pls share me the code....

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d79a7ebe-2861-4a6f-aaa6-b9e1772081b2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Find Broken links in an Application using Selenium Webdriver....?

ra cras
In reply to this post by neeraj bakhtani
With selenium I don't know, but I use Xenu

Em sábado, 14 de setembro de 2013 03h52min39s UTC-3, neeraj bakhtani escreveu:
Hi,
How can we find broken links or Broken images in an application by using Selenium Webdriver....?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e441a419-97e3-4fae-9a99-33f24367cee3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Find Broken links in an Application using Selenium Webdriver....?

neeraj bakhtani
Find the SOlution here

http://bugreaper.blogspot.in/2013/09/find-broken-images-for-application-or.html

Join the Blog and if you like the post pls comment....:)


On Wed, Jan 15, 2014 at 6:21 PM, ra cras <[hidden email]> wrote:
With selenium I don't know, but I use Xenu

Em sábado, 14 de setembro de 2013 03h52min39s UTC-3, neeraj bakhtani escreveu:
Hi,

How can we find broken links or Broken images in an application by using Selenium Webdriver....?

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/nCBLoagMKIs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e441a419-97e3-4fae-9a99-33f24367cee3%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CACTtaWn6Cw4y9XALCoZBJeqF9mJn2%2BGnr66xe-Vqb9MWqpVY_w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Find Broken links in an Application using Selenium Webdriver....?

Omkar Kolekar
Thank you dear..............
i will check and let u know



On Wed, Jan 15, 2014 at 6:34 PM, neeraj bakhtani <[hidden email]> wrote:
Find the SOlution here

http://bugreaper.blogspot.in/2013/09/find-broken-images-for-application-or.html

Join the Blog and if you like the post pls comment....:)


On Wed, Jan 15, 2014 at 6:21 PM, ra cras <[hidden email]> wrote:
With selenium I don't know, but I use Xenu

Em sábado, 14 de setembro de 2013 03h52min39s UTC-3, neeraj bakhtani escreveu:
Hi,

How can we find broken links or Broken images in an application by using Selenium Webdriver....?

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/nCBLoagMKIs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e441a419-97e3-4fae-9a99-33f24367cee3%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/nCBLoagMKIs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CACTtaWn6Cw4y9XALCoZBJeqF9mJn2%2BGnr66xe-Vqb9MWqpVY_w%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAE%2B4gCZ616PeO3b%2BUcwbfsHwQzSsniUavZqAy5BP_p7aUxeHrA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Find Broken links in an Application using Selenium Webdriver....?

Omkar Kolekar
That code is not working on broken links.............and even for 404 error.........
pls help ........



On Thu, Jan 16, 2014 at 10:14 AM, Omkar Kolekar <[hidden email]> wrote:
Thank you dear..............
i will check and let u know



On Wed, Jan 15, 2014 at 6:34 PM, neeraj bakhtani <[hidden email]> wrote:
Find the SOlution here

http://bugreaper.blogspot.in/2013/09/find-broken-images-for-application-or.html

Join the Blog and if you like the post pls comment....:)


On Wed, Jan 15, 2014 at 6:21 PM, ra cras <[hidden email]> wrote:
With selenium I don't know, but I use Xenu

Em sábado, 14 de setembro de 2013 03h52min39s UTC-3, neeraj bakhtani escreveu:
Hi,

How can we find broken links or Broken images in an application by using Selenium Webdriver....?

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/nCBLoagMKIs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e441a419-97e3-4fae-9a99-33f24367cee3%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/nCBLoagMKIs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CACTtaWn6Cw4y9XALCoZBJeqF9mJn2%2BGnr66xe-Vqb9MWqpVY_w%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAE%2B4gCZiz3tXGo73ze4gzJoAVt28JWGVD_2Lp7Z3XZZjDFhuPw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...