No video

How to Find Broken Links using Selenium WebDriver? | selenium interview questions |

  Рет қаралды 22,268

H Y R Tutorials

H Y R Tutorials

Күн бұрын

In this video, I have explained about "How to Find Broken Links using Selenium WebDriver?".
Video Timeline:
00:00 What is Broken Link?
00:45 Some of the reasons why links don’t work?
01:32 Demo of Broken Links on Real-time application
02:50 Java Program to find the Broken Links
12:22 Change the Java Program to Print only Broken Links using Set
14:43 How to find the broken links behind the Proxy?
A broken link is a link on a website that is no longer accessible/works.
Broken links are links that don’t work. Some of the reasons why links don’t work include:
👉A website is no longer available
👉A webpage was moved without a redirect being added
👉The URL structure of a website was changed
If you click a broken link, you’ll see a 404-page error or similar message explaining the webpage is not available.
Practice Websites: 👇
www.hyrtutorials.com/
www.theworldsworstwebsiteever...
www.deadlinkcity.com/
You can find the program at my GitHub repository: 👇
bit.ly/2Fq6k2J
==============================================
↔️ Selenium Interview Questions Playlist Link: bit.ly/3matUB3
✴ Checkout my other playlists: bit.ly/3gLIAVL
☕ Buy me a coffee: bit.ly/33ljBWc
👑 Join my KZfaq channel to get access to perks:👇
/ @hyrtutorials
==============================================
==============================================
Connect us @
🔗 Website - www.hyrtutorials.com
🔗 Telegram - t.me/hyrtutorials
🔗 Facebook - / hyrtutorials
🔗 LinkedIn - / hyrtutorials
🔗 Twitter - / hyrtutorials
🔗 Instagram - / hyrtutorials
==============================================
==============================================
🙏 Please Subscribe🔔 to start learning for FREE now, Also help your friends in learning the best by suggesting this channel.
#hyrtutorials #selenium #interviewQuestions #webAutomation
Selenium Interview Questions By Yadagiri Reddy
h y r tutorials hyr tutorials selenium interview questions and answers selenium tutorial for beginners selenium java selenium interview questions and answers selenium tutorial for beginners selenium java
selenium selenium java selenium tutorial for beginners automation testing selenium webdriver

Пікірлер: 91
@HYRTutorials
@HYRTutorials 3 жыл бұрын
📌 Selenium Interview Questions Playlist Link: bit.ly/3matUB3 ✴ Checkout my other playlists: bit.ly/3gLIAVL ☕ Buy me a coffee: bit.ly/33ljBWc
@abslutedesi3021
@abslutedesi3021 3 жыл бұрын
want to talk with you. mail me if possible naveenrathore.214@gmail.com
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Reach out to me on hyadagirireddytutorials@gmail.com
@gayathrivegesna7464
@gayathrivegesna7464 9 ай бұрын
Your Explanation is awesome thank you for such useful videos
@sajtly-web-dizajn
@sajtly-web-dizajn 6 ай бұрын
Great tutorial 👍
@AnkitSingh-be4wi
@AnkitSingh-be4wi 3 жыл бұрын
Briefly explained 👍👍
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou, keep watching.
@C.Sakthivignesh
@C.Sakthivignesh Жыл бұрын
Thank you so much sir for made this video.
@HYRTutorials
@HYRTutorials Жыл бұрын
Happy learning buddy 😊
@ChayaE-yw8tm
@ChayaE-yw8tm 2 ай бұрын
good Explanation
@harishgajjela4191
@harishgajjela4191 3 жыл бұрын
Super Brother Nice Explanation
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thank you bro 🙂
@rihanya_jethin4593
@rihanya_jethin4593 2 жыл бұрын
super explanation sir
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thank you buddy
@shubhamkori2805
@shubhamkori2805 3 жыл бұрын
Very good explanation sir👌
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou
@nipunijayasinghe3575
@nipunijayasinghe3575 Жыл бұрын
Thank you 😊
@HYRTutorials
@HYRTutorials 11 ай бұрын
Happy learning buddy 😊
@yaswanthtirupathi6551
@yaswanthtirupathi6551 Жыл бұрын
Thank you so much bro
@HYRTutorials
@HYRTutorials Жыл бұрын
Happy learning buddy
@ulissesdasilva1314
@ulissesdasilva1314 3 жыл бұрын
Hi Could you make a videos on Integration API automation test? using Post Man ? - Thanks!
@HYRTutorials
@HYRTutorials 3 жыл бұрын
I have no idea about that
@aswathys8884
@aswathys8884 Жыл бұрын
While executing this code, it shows the links with status 200 & broken links too, but after printing a few links, it is showing an error message: "stale element reference: element is not attached to the page document". Rest links status as well as the driver.quit() is not getting executed.
@HYRTutorials
@HYRTutorials Жыл бұрын
Send me the code on hyadagirireddytutorials@gmail.com
@pradeepjana1427
@pradeepjana1427 3 жыл бұрын
How can we do this protractor? Is there any package available in npm?
@HYRTutorials
@HYRTutorials 3 жыл бұрын
No idea about protractor dude
@ilavarasansriraman4140
@ilavarasansriraman4140 3 жыл бұрын
Interview question that I faced today : page contains 2 download links How to click the second download link using linktext? //a[text() ='download'] this xpath - 2 matching found.. I am not able to locate the second download link using proper xpath. Could u pls give me a solution for this??
@HYRTutorials
@HYRTutorials 3 жыл бұрын
You can use the index for achieving this. Try this: (//a[text() ='download'])[2]
@ilavarasansriraman4140
@ilavarasansriraman4140 3 жыл бұрын
@@HYRTutorials yes sir.. This is what I did.. Working fine.. Love u so much brother ✨
@KaranSharma-lm6eh
@KaranSharma-lm6eh 2 жыл бұрын
@@ilavarasansriraman4140 taking 2nd index value by using xpath : (//xpath)[2]
@shreyanshsingh2782
@shreyanshsingh2782 2 жыл бұрын
sir why proxy issues will come in company not at home , what is a proxy why we need to set , if you can make a video it will be hepful
@HYRTutorials
@HYRTutorials 2 жыл бұрын
In companies they will use proxy for not allowing any unknown internet traffic. That's why u can't open all the websites and u can't download everything. To download anything behind this proxy, you need to talk to the IT team in your company. They can explain even better
@rihanya_jethin4593
@rihanya_jethin4593 2 жыл бұрын
sir after doing this program for me not getting any error just showing total number of present on the webpage is: 0
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Can u send me the script on hyadagirireddytutorials@gmail.com
@ilyasyar
@ilyasyar 3 жыл бұрын
Nice video, thanks a lot ,and is there anyway to find images ? all 3 types of images if they are show or they are damaged on the website , Thanks ,please let me know .
@HYRTutorials
@HYRTutorials 3 жыл бұрын
It's almost similar to this one. We have to use httpclient class to verify the images
@ioriiori
@ioriiori 3 жыл бұрын
H Y R Tutorials do you have video of finding all broken images? Please , really want to see it .
@HYRTutorials
@HYRTutorials 3 жыл бұрын
@@ioriiori I don't have but will make the video on that.
@ioriiori
@ioriiori 3 жыл бұрын
H Y R Tutorials thank you so much , you are so kind 😊
@ilyasyar
@ilyasyar 3 жыл бұрын
@@HYRTutorials Thanks a lot , I'm also waiting for your video about find all broken images ,thank you ,my brother ,you are so nice .
@SayaliBhilawade
@SayaliBhilawade 2 жыл бұрын
While executing this code I am facing error like PKIX path building failed and also unable to find valid certification path to requested target Can you plz make solution video on this?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
I don't think that error has something to do with selenium
@shahulhameed-io8lj
@shahulhameed-io8lj 2 жыл бұрын
Bro while doing Broken links iam getting Stale Element Exception Pls Tell How to Handel it in Broken links
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Can you send me your code on hyadagirireddytutorials@gmail.com. I need to understand in which scenario you are getting that exception
@sbc4071
@sbc4071 2 жыл бұрын
I'm getting WebdriverManager error after public static void main
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Can u paste the full error here or can you send me the screenshot of that error on hyadagirireddytutorials@gmail.com
@Bell4Fun
@Bell4Fun 2 жыл бұрын
Add webDriver Dependencyin the POM file
@rajeshrao5099
@rajeshrao5099 2 жыл бұрын
Hi could you please share code in description?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
The link is already in the description buddy
@chirunomulavenkatesh
@chirunomulavenkatesh 3 жыл бұрын
How to find whether url is secured or not ??
@HYRTutorials
@HYRTutorials 3 жыл бұрын
You can verify whether it is http or https.
@bulatshukanov8764
@bulatshukanov8764 2 жыл бұрын
When I ran your code I get StaleElementReferenceException. do you know why?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
May be the page is refreshed before clicking on the element
@mupparajuveeranji5113
@mupparajuveeranji5113 2 жыл бұрын
@@HYRTutorials How to fix it?? Stale element reference: element is not attached to the page document
@Bell4Fun
@Bell4Fun 2 жыл бұрын
@@mupparajuveeranji5113 Only solution is to handle that link in try catch block
@ilyasyar
@ilyasyar 3 жыл бұрын
Hello ,I am here again ...how can I use this script to find all broken links from whole website ,not only from one page ? please.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
That is not possible Ilyas. because the page content is loaded only when you open that page. By default when we open the homepage, the entire website content will not be loaded hence we can't verify all the links.
@ilyasyar
@ilyasyar 3 жыл бұрын
@@HYRTutorials Thanks a lot ,I will keep learning then .
@subaidhasy1771
@subaidhasy1771 2 жыл бұрын
@@HYRTutorials when I run the coding it's shows like not found 404
@HYRTutorials
@HYRTutorials 2 жыл бұрын
@@subaidhasy1771 so that means the page is not available
@subaidhasy1771
@subaidhasy1771 2 жыл бұрын
@@HYRTutorials why
@sumitanand1373
@sumitanand1373 3 жыл бұрын
Exception in thread "main" java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebElement cannot be cast to java.util.List at br1.Broken_link.main(Broken_link.java:25) I am getting this error.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
I think you are using findelement method instead of findelements method
@sumitanand1373
@sumitanand1373 3 жыл бұрын
@@HYRTutorials I corrected it but now another error as below: Exception in thread "main" java.net.UnknownHostException: hostname at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient$1.run(Unknown Source) at sun.net.www.http.HttpClient$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.http.HttpClient.privilegedOpenServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.protocol.https.HttpsClient.(Unknown Source) at sun.net.www.protocol.https.HttpsClient.New(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source) at br1.BR3.main(BR3.java:39)
@sumitanand1373
@sumitanand1373 3 жыл бұрын
Below is the entire code: package br1; import java.io.IOException; import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.URL; import java.net.URLConnection; import java.util.HashSet; import java.util.List; import java.util.Set; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class BR3 { public static void main(String[] args) throws InterruptedException, IOException { System.setProperty("webdriver.chrome.driver", "../Selenium/chromedriver.exe"); ChromeDriver driver= new ChromeDriver(); driver.get("www.hyrtutorials.com/"); Thread.sleep(5000); Set brokenlinkUrls = new HashSet(); List links = driver.findElements(By.tagName("a")); System.out.println(links.size()); for (WebElement link : links) { String linkURL = link.getAttribute("href"); Proxy proxy = new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress("hostname", 80)); URL url = new URL(linkURL); URLConnection urlConnection = url.openConnection(proxy); HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection; httpURLConnection.setConnectTimeout(5000); httpURLConnection.connect(); if(httpURLConnection.getResponseCode() != 200) { brokenlinkUrls.add(linkURL); } // System.out.println(linkURL + " - " + httpURLConnection.getResponseMessage()); // else // System.err.println(linkURL + " - " + httpURLConnection.getResponseCode() + " - " + httpURLConnection.getResponseMessage()); httpURLConnection.disconnect(); } driver.quit(); for (String brokenLinkUrl : brokenlinkUrls) { System.err.println(brokenLinkUrl); } } }
@HYRTutorials
@HYRTutorials 3 жыл бұрын
@@sumitanand1373 remove the proxy creation. It is required only when u r working on some private network like vpn in your office
@sumitanand1373
@sumitanand1373 3 жыл бұрын
@@HYRTutorials I have removed the proxy creation but still error exist. Exception in thread "main" java.net.MalformedURLException at java.net.URL.(Unknown Source) at java.net.URL.(Unknown Source) at java.net.URL.(Unknown Source) at br1.BR3.main(BR3.java:34) Caused by: java.lang.NullPointerException ... 4 more NOTE: on the click of the BR3.java.34 it redirect me to the URL url = new URL(linkURL); this line of code. Kindly help. I need to implement in project. Thanks for your help. Below is the code import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.HashSet; import java.util.List; import java.util.Set; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class BR3 { public static void main(String[] args) throws Exception { System.setProperty("webdriver.chrome.driver", "../Selenium/chromedriver.exe"); ChromeDriver driver= new ChromeDriver(); driver.get("www.hyrtutorials.com/"); Thread.sleep(5000); Set brokenlinkUrls = new HashSet(); List links = driver.findElements(By.tagName("a")); System.out.println(links.size()); for (WebElement link : links) { String linkURL = link.getAttribute("href"); URL url = new URL(linkURL); URLConnection urlConnection = url.openConnection(); HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection; httpURLConnection.setConnectTimeout(5000); httpURLConnection.connect(); if(httpURLConnection.getResponseCode() != 200) { brokenlinkUrls.add(linkURL); } // System.out.println(linkURL + " - " + httpURLConnection.getResponseMessage()); // else // System.err.println(linkURL + " - " + httpURLConnection.getResponseCode() + " - " + httpURLConnection.getResponseMessage()); httpURLConnection.disconnect(); } driver.quit(); for (String brokenLinkUrl : brokenlinkUrls) { System.err.println(brokenLinkUrl); } }
@nagalakshmiv1997
@nagalakshmiv1997 2 жыл бұрын
Same code can u please make on python as well
@HYRTutorials
@HYRTutorials 2 жыл бұрын
The concept is going to be same buddy. You can try with python and if you get stuck let me know
@nagalakshmiv1997
@nagalakshmiv1997 2 жыл бұрын
Thanks for your reply, I was able print all the url and attribute value, I got stuck in, if condition like how to implement all that response code and all.....
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Do u know python language buddy? If you know then implementing logics using basic programming is easy.
@Naru-pg1wi
@Naru-pg1wi 4 ай бұрын
Ok
@sonalibhad3764
@sonalibhad3764 2 жыл бұрын
So fast teaching
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Sorry for that buddy.
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 15 МЛН
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 17 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 18 МЛН
How to Create Excel File using Apache POI | Selenium WebDriver |
14:34
H Y R Tutorials
Рет қаралды 37 М.
Handling of Bootstrap Dropdowns using #Selenium WebDriver | Selenium |
37:03
How to Handle Frames in Selenium WebDriver
21:20
H Y R Tutorials
Рет қаралды 57 М.
Capture Screenshots using Selenium WebDriver | Selenium WebDriver |
19:44
Explain OOPS Concepts in Selenium Automation Framework
20:04
RD Automation Learning
Рет қаралды 21 М.
P23 - Perform Mouse  Actions in Selenium WebDriver | తెలుగు |
23:40
How to Read Excel File using Apache POI | Selenium WebDriver |
21:25
H Y R Tutorials
Рет қаралды 44 М.
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 15 МЛН