0

I have more than 100's of URL's which will be redirecting (301 redirects) to a new page. Since i do not want to manually verify each link redirection, is there a way any tool/api or script that would aid me in automating these steps. Takes input URL, checks for expected URL and gives me the correct HTTP status.

I did try to write a Java webdriver script which reads excel file to fetch Test URL, Expected URL & Actual URL on execution. Script opens the browser and checks for the page redirection. Sometimes i need to login into the page to check redirection. I felt the entire program was taking more time to execute for 100's of URL's since its browser(GUI) based...

Any script that can help me check for redirection and HTTP status would be great!

Any feedback greatly appreciated. Cheers

Jlearner
  • 45
  • 1
  • 9
  • When you say redirection do you mean a user will simply click links on the page, and you need to make sure they actually route to the correct URL? If yes, Selenium Webdriver (sounds like you already did this) is a good tool to use. Its very quick and shouldn't take that long even to test 100's of simple URL redirects. If you're concerned with the physical time it takes to click each link, you could take the backend approach and validate that each HTML link has the correct URL associated with it compared to your excel list (probably the href tag). – Jason Jun 18 '14 at 01:03

1 Answers1

1

So depending on what you mean by "login into the page to check redirection". You could write a script that uses HttpURLConnection: http://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html

Just write a program with a thread that periodically connects through the HttpURLConnection and checks the status of the request.

  • Well here is a page that gives more detail. I can put something together if you have trouble. http://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests – user3689670 Jun 19 '14 at 19:20