Why do we need to typecast the WebDriver Instance to use TakeScreenshot or JavascriptExecutor?

  Рет қаралды 26,761

H Y R Tutorials

H Y R Tutorials

Күн бұрын

In this video, I have explained about "Why do we need to typecast the WebDriver instance to use TakeScreenshot or JavascriptExecutor Interface methods".
WebDriver is an interface with a set of unimplemented methods.
WebDriver drives a browser natively, as a user would, either locally or on a remote machine using the Selenium server, marks a leap forward in terms of browser automation.
Selenium WebDriver refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just WebDriver.
Selenium WebDriver is a W3C Recommendation
- WebDriver is designed as a simple and more concise programming interface.
- WebDriver is a compact object-oriented API.
- It drives the browser effectively.
When working with selenium, we typecast the webdriver instance in order to use the methods from TakeScreenshot or JavascriptExecutor interfaces.
So basically java doesn't allow us to create the interface objects, so that is the reason we always typecast the webdriver instance.
But do you know what exactly what happens when you typecast it and why we need to typecast it?
Watch this video to learn more about typecasting of webdriver instance.
==============================================
↔️ 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

Пікірлер: 120
@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
@sirisha234
@sirisha234 3 жыл бұрын
Just wow. What a nice way of explanation. That particular diagram is a million dollar worth.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou 😊 Diagram makes the topic easy and more understandable.
@ferdanondrej
@ferdanondrej Жыл бұрын
Great explanation of all important topics related to instantiation of WebDriver and typecasting I could find in one video, thank you!
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@anichavan11
@anichavan11 3 жыл бұрын
Very good explanation and after watching full video came to know the main reason for typecasting. Please make more videos like this. 👍
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thank you, I will
@swayamkarnjkar6516
@swayamkarnjkar6516 3 жыл бұрын
One of the very best explanation, I have ever came across you are awesome. you should make more videos on interview questions
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thank you, I will
@gpavankumar175
@gpavankumar175 2 жыл бұрын
Superb explaination. I was wondering why we are typecasting and what is it. Thanks, now clear.
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Super 😊
@AnkitSingh-be4wi
@AnkitSingh-be4wi 3 жыл бұрын
Nice explaination using interface and inheritance all together 👍 Watched twice to recollect everything together..
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thank you 😊
@veganforlife4699
@veganforlife4699 7 ай бұрын
Best explanation, thanks mate. Gratitude 🙏🙏🙏
@tejpatel2743
@tejpatel2743 2 жыл бұрын
one of the very good video and topic on the internet and the explanation way is very simple and good. this was one of the question in my mind from a long time, today i thought lets check on youtube and i found you. Thanks you sir for explaning this in very excellet way . Thanks a lot.
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thankyou buddy 😊
@umadevi-yo3yl
@umadevi-yo3yl 2 жыл бұрын
Well explained 🙏🙏non technical people also can understand easily thank you so much 👏👏
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thankyou 😊
@adityakavathale58
@adityakavathale58 Жыл бұрын
Thanks for the explanation sir. That diagram helps a lot.
@HYRTutorials
@HYRTutorials Жыл бұрын
Happy learning buddy 😊
@pasha9327
@pasha9327 3 жыл бұрын
Great Explanation.thank you so much.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Glad you liked it
@paresh3915
@paresh3915 Жыл бұрын
Great explanation, Thank you very much!
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@jagsautomation2759
@jagsautomation2759 9 ай бұрын
Excellent explanation.
@guruishu7766
@guruishu7766 3 жыл бұрын
Perfect explanation as usual
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thank you 😊 Stay tuned for more videos like this
@chithrarajeswaran730
@chithrarajeswaran730 Жыл бұрын
perfect explanation.. very easy to understand.. thanks much bro
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@rupalibhagat1989
@rupalibhagat1989 Жыл бұрын
Excellent way of teaching......
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@Suukhhh
@Suukhhh Жыл бұрын
You are brilliant... Really Really Helpfull... Thank you sir
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@owel09
@owel09 2 жыл бұрын
thank you. You explain it very well
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thankyou 😊
@sathishvijay3476
@sathishvijay3476 2 жыл бұрын
Very clear explanation
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thanks buddy 😊
@C.Sakthivignesh
@C.Sakthivignesh Жыл бұрын
Thanks sir for made this video.
@HYRTutorials
@HYRTutorials Жыл бұрын
Happy learning buddy 😊
@Bala786A
@Bala786A 3 жыл бұрын
Good explained..... Thank you 👍
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Glad it was helpful!
@akshaysagare5378
@akshaysagare5378 3 жыл бұрын
Very nice explaination
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thank you 😊 Keep watching
@hiteshdarji9925
@hiteshdarji9925 2 жыл бұрын
Nice. Very good explanation.
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thankyou 😊
@PradipYogi59
@PradipYogi59 2 жыл бұрын
Very good explanation
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thanks for liking
@zeeshanahmed9943
@zeeshanahmed9943 3 жыл бұрын
Very good explanation...you are awesome...:)
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thanks a lot 😊
@hemangishelake4379
@hemangishelake4379 3 жыл бұрын
Wow😍. What a explanation. Could you please make more videos on interview questions
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou, Sure 😊
@harinihar2468
@harinihar2468 3 жыл бұрын
Neat explanation 👌👏..thank you subscribed 👍
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou 😊
@user-cw2fi2tk9e
@user-cw2fi2tk9e Жыл бұрын
simply super bro
@HYRTutorials
@HYRTutorials 11 ай бұрын
Thanks buddy 😊
@yuvasrivanth
@yuvasrivanth 2 жыл бұрын
Excellent one 🙏
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thankyou 😊
@pramothcr1503
@pramothcr1503 Жыл бұрын
wow simply awesome !
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@yaswanthtirupathi6551
@yaswanthtirupathi6551 Жыл бұрын
Thank you so much bro
@HYRTutorials
@HYRTutorials Жыл бұрын
Happy learning buddy
@arreddypala5058
@arreddypala5058 2 жыл бұрын
Super explanation
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thankyou buddy 😊
@harisake6068
@harisake6068 7 ай бұрын
Thank you
@abinashprakash804
@abinashprakash804 2 жыл бұрын
awesome
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thankyou buddy 😊
@chinnikrishnad6736
@chinnikrishnad6736 4 ай бұрын
Wonderful HYR garu. Then, can we directly do as following? RemoteWebDriver driver=new RemoteWebDriver(); and use it? Kindly reply. And, as always, Thanks for your great teaching.
@sujitblues
@sujitblues 3 ай бұрын
please create java interview series (coding & conceptual ) both
@rishabhmehta9498
@rishabhmehta9498 Жыл бұрын
Thankyou
@HYRTutorials
@HYRTutorials Жыл бұрын
Happy learning buddy 😊
@parvinkouliev11
@parvinkouliev11 2 жыл бұрын
Excellent explanation. Can you also explain why don't we just use RemoteWebDriver class to create driver instance in this case which would not need typecasting since RemoteWebDriver inherits all methods of all 3 interfaces.
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Yes we can use remotewebbriver class as well. There is nothing wrong in using it but the only reason we usually use the webdriver is because of its name. Remotewebbriver is more often used for remote execution where you mention the ip address and port number. So for all local executions we use webdriver. It's just a standard we usually follow but if we want to maintain the uniformity then we can always use the remotewebbriver class.
@youshouldknow9369
@youshouldknow9369 2 жыл бұрын
Till Selenium v3, ChromeDriver extends RemoteDriver. This ChromeDriver was a WebDriver implementation that controlled the google-chrome browser running on the local machine.
@manikandankm3974
@manikandankm3974 2 жыл бұрын
@@HYRTutorials Hello Sir , I have a doubt here , Even we use Webdriver instance here , Remotewebdriver Inherits its properties and Again All the browser class INHERITS the properties of Remowebdriver ( Chromedriver Extends RemoteWebdriver) , In this case we don't requires typecasting right , The browser classes have all the method implementation of JS Interface and driver automatically takes the Methods of JS ?? Please clarify.
@mycreativelife2837
@mycreativelife2837 Жыл бұрын
👏👏👏👏👏
@HYRTutorials
@HYRTutorials 11 ай бұрын
Thanks buddy 😊
@swapnabhaskaruni
@swapnabhaskaruni 2 жыл бұрын
Looks like there are more selenium tutorials in english playlist than the selenium telugu playlist. If there are any missed topics in telugu playlist can you do them in telugu too. Its just easy to process in telugu. and i feel because our mother tongue is telugu explanation and understanding is easier and faster in telugu. Please consider my request.
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Some of the additional topics are covered in English and the interview questions are also created in English only. I will create them in telugu language but it may take some time
@chayae3740
@chayae3740 3 жыл бұрын
Tqu
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Glad you find it helpful
@rahulyadav-cl2rd
@rahulyadav-cl2rd 10 ай бұрын
@kumarshubham5537
@kumarshubham5537 9 күн бұрын
Can you please tell me how to say these answers precisely in interview as we won't have any script over there.
@RAHULKUMAR-rb6pl
@RAHULKUMAR-rb6pl 3 ай бұрын
Sir whenever we said typecasting for javascriptExecutor in that situation to be more precise we can say it is also upcasting or not
@madhukrishna5704
@madhukrishna5704 9 ай бұрын
As per the typecasting rule: The object(TakesScreenshot) type should be same or parent of runtime object of driver,i.e(Cromedriver). 1)It works when both are related to class. 2)But i don't know when they are interfaces and classes.(TakesScreenshot is a interface and Chromedriver is a class). Is same typecasting rule applied to above statements? If not could pls clarify my doubt?
@alaharimeenasri7168
@alaharimeenasri7168 3 жыл бұрын
please do more viodes on inetrview questions bro , whenever you are free...
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Yeah sure, currently I'm not getting much time in this month. Will make those videos in next month for sure
@alaharimeenasri7168
@alaharimeenasri7168 3 жыл бұрын
Ok bro thanks ☺️☺️..
@ManiKandan-vo2qr
@ManiKandan-vo2qr 3 жыл бұрын
Hello Sir , JavaScript Executor is also an interface right? So Even though we type cast into JavaScript executor , How can we access the method executescript() which is un-Implemented still in interface ? Please tell me
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Basically here we alrdy have the fully implemented driver but when u r creating the driver instance type as webdriver then you can only access methods inside the webdriver interface even though it has the JavaScriptExecutor methods code. So that is why we are typecasting it to JavaScriptExecutor.
@sricharanrao1812
@sricharanrao1812 3 жыл бұрын
@@HYRTutorials Hello Sir. I had the same question and I did not understand this answer. Could you please simplify.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
@@sricharanrao1812 to understand this, have some basic understanding of interfaces and classes. It's very easy once you got some basic idea about those.
@swapnabhaskaruni
@swapnabhaskaruni 2 жыл бұрын
@@HYRTutorials so do you mean because we write a statement WebDriver driver = new ChromeDriver() and the ChromeDriver class has all the methods implemented from WebDriver, JavaScriptExecutor and TakesScreenshot we are able to typecast the driver and access other interface class methods. But if we write WebDriver driver = new WebDriver() then the typecast would not work. Please correct me.
@HYRTutorials
@HYRTutorials 2 жыл бұрын
@@swapnabhaskaruni first of all you can't create an object for webdriver. Check your second statement one more time
@ksdnsdkumar1375
@ksdnsdkumar1375 2 жыл бұрын
You didn't mention "RemoteWebDriver" anywhere, then why did you include in the diagram?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Remotewebdriver is the class where all the interferences are implemented buddy
@MyGreatAchievers
@MyGreatAchievers 9 ай бұрын
when there is no relashion between webdriver and takescreenshort references then how can we typecasting it? please explain.
@Sowmya598
@Sowmya598 3 жыл бұрын
Sir.. every one uses if else condition to choose d browser.. but u have used switch is der any reason behind dat.. thanks in advance
@HYRTutorials
@HYRTutorials 3 жыл бұрын
In if else condition everytime u r checking minimum 1 condition and if that condition fails then again it will go for another condition. Like that it continues condition checking. So to avoid that we have to use switch condition.
@Sowmya598
@Sowmya598 3 жыл бұрын
Thanks for d reply..😊 so in case of switch condition it directly jumps to d case on which we want to run our testscripts without​ checking each n every case
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Exactly.
@mjj3tube
@mjj3tube 2 жыл бұрын
When we say Takescreenshot ts = (Takescreenshot ) driver , is this up casting or down casting ?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
you could say upcasting only but we shouldn't use the down casting or upcasting words here instead we should simply call it as typecasting.
@mjj3tube
@mjj3tube 2 жыл бұрын
@@HYRTutorials got it thanks for the kind response
@adityatripathi3379
@adityatripathi3379 2 жыл бұрын
Why we don't write RemoteWebDriver driver = new ChromeDriver(); ?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
We can write and there is nothing wrong in that. It's just that by name we can see. Remotewebdriver is mostly used for remote connections.
@raghavendrasaicharan3188
@raghavendrasaicharan3188 3 жыл бұрын
What is difference between extends and implements.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Implements and extends are keywords. Implements is used when you want implement the unimplemented methods from interfaces. Extends is used when you want to inherit other class properties like attributes and methods. So it is mostly used in inheritance concepts.
@subhashinic7000
@subhashinic7000 Жыл бұрын
Why are we not typecasting it when we use ChromeDriver driver; ?
@HYRTutorials
@HYRTutorials 11 ай бұрын
Because typecasting is not required buddy
@ferozkhanr6653
@ferozkhanr6653 Жыл бұрын
Can we declare like RemoteWebDriver driver = new chromeDriver();
@HYRTutorials
@HYRTutorials Жыл бұрын
Yes we can declare buddy. When working with remote execution that's how we do it
@ferozkhanr6653
@ferozkhanr6653 Жыл бұрын
@@HYRTutorials How to handle captcha in selenium, any third party lib is supported ?
@HYRTutorials
@HYRTutorials Жыл бұрын
@@ferozkhanr6653 No we cant handle the capta in selenium buddy. If your application has that feature then you can ask the dev to provide some property for the capta control or you can ask them to turnoff that in the test enevs
@babupemmada1580
@babupemmada1580 Жыл бұрын
What is unimplemented methods sir?
@HYRTutorials
@HYRTutorials Жыл бұрын
In java we have the concept of abstract methods and non abstract methods. Abstract methods are also called as unimplemented methods. These methods are present in either interface it abstract class.
@116sivaramakrishnasai2
@116sivaramakrishnasai2 2 жыл бұрын
Why don't we use RemoteWebDriver?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
We can use without any problem buddy. But it's just the naming convention. Remotewebdriver is mostly used for remote connections
@ksdnsdkumar1375
@ksdnsdkumar1375 2 жыл бұрын
@10:00 Thank me later.
@HYRTutorials
@HYRTutorials 2 жыл бұрын
😊
@mohanramakrishnakonijety9405
@mohanramakrishnakonijety9405 19 күн бұрын
Thank you
ВОДА В СОЛО
00:20
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 33 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 10 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 17 МЛН
A Practical Example How To Use Interfaces In Golang
14:42
Anthony GG
Рет қаралды 22 М.
Why use Type and not Interface in TypeScript
14:12
ByteGrad
Рет қаралды 199 М.
Enter Text into a Textbox using JavascriptExecutor in Selenium WebDriver
17:11
Capture Screenshots using Selenium WebDriver | Selenium WebDriver |
19:44
Selenium Webdriver Hierarchy In Interview | Automation Interview
17:26
Handling of Bootstrap Dropdowns using #Selenium WebDriver | Selenium |
37:03