SingletonDesign Pattern In Java || How to achieve Singleton In Selenium WebDriver

  Рет қаралды 79,658

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

Пікірлер: 35
@ChethanCP
@ChethanCP Жыл бұрын
Awesome, very nice explanation
@varshatc4771
@varshatc4771 5 жыл бұрын
This is important interview question👍
@1824ajay
@1824ajay 6 жыл бұрын
Hey Naveen, Man this is so helpful i have implemented this and also was asked in an interview about this! As always very informative and concise!!
@WMohanty
@WMohanty 5 жыл бұрын
Thanks. God bless Naveen.
@yanivbendror7579
@yanivbendror7579 6 жыл бұрын
Hi naveen , great video. one small thing - regarding lines 25,26 I'm not sure it's correct to say that nothing return ( 14:15 , 14:47 ) , since what's actually return is the 'singleton_instance' , which means y,z will point to the same address as x , that's why when you print y.str and z.str you get the same upper case string as x.str
@NileshKumar-mk2ze
@NileshKumar-mk2ze 5 жыл бұрын
Hello Sir, I have one question If Two threads are accessing the Singleton class object at time then what will happen or what problem will come and how we resolve such problem.
@shwetayadav4244
@shwetayadav4244 3 жыл бұрын
Always the best
@aravinda8330
@aravinda8330 6 жыл бұрын
Hi Naveen Thanks for very informative video on singleton class.
@nikhilbhaleraoballya
@nikhilbhaleraoballya 4 жыл бұрын
just want to know what will happen when we use this code for doing parallel execution in testNG
@aleksandrefimov8754
@aleksandrefimov8754 5 жыл бұрын
Hey, It looks like there is problem in your example. If we call openBrowser() method twice - than it opened two chrome browsers. So I think we should move this line "driver = new ChromeDriver" or in private constructor or in if block of getInstance method. So after that we avoid of possibility to open two browsers at the same time.
@rahulsahay5973
@rahulsahay5973 2 жыл бұрын
Correct
@srinathmohan615
@srinathmohan615 2 жыл бұрын
public WebDriver driverinit(){ WebDriverManager.chromedriver().setup(); if (driver==null){ driver = new ChromeDriver(); } return driver;
@ilavarasansriraman4140
@ilavarasansriraman4140 3 жыл бұрын
Awesome :)
@ujjwalverma7787
@ujjwalverma7787 6 жыл бұрын
hello, sir your huge fan. I have one doubt on time 10.38 why you call a static method with classname "Singleton x =Singleton.getinstance();" we can call a method directly "Singleton x = getinstance();" its worked and according to me there no need to call through the class name. please explain it Sir !! thank you !
@naveenautomationlabs
@naveenautomationlabs 6 жыл бұрын
Yes that's also fine
@ahmedsalahel-din1311
@ahmedsalahel-din1311 5 жыл бұрын
Thank you for the great video, I have a comment: What if you have multiple test methods in your Test Class??? let's say we have another test method called public void test02() {} before this method you're trying to get an instance of WebDriver, it will never create a new instance of our Singleton class (Driverinit), but simultaneously the instance of WebDriver is not null, moreover try to handle any element in the second test method, it will throw (SessionNotCreatedException) as you've already quitted or closed the driver!!!
@bodhiderrick3515
@bodhiderrick3515 3 жыл бұрын
i guess I'm quite off topic but does anybody know of a good site to watch new movies online?
@majormalachi1901
@majormalachi1901 3 жыл бұрын
@Bodhi Derrick flixportal =)
@bodhiderrick3515
@bodhiderrick3515 3 жыл бұрын
@Major Malachi Thanks, signed up and it seems like a nice service :D I appreciate it !
@majormalachi1901
@majormalachi1901 3 жыл бұрын
@Bodhi Derrick glad I could help :)
@meenutabassumkhan6306
@meenutabassumkhan6306 6 жыл бұрын
what is a use of singleton class?
@toxicsahu
@toxicsahu 6 жыл бұрын
@Naveen Automation Labs : Please Create Video for "Serialization and Deserialization in Java" and its Implementation in Automation Framework. Thanks ~PS
@amangupta9949
@amangupta9949 5 жыл бұрын
sir while changing x.str valve other 2 reference value changed. And same thing is repeated in z.str value is it corroct sir.And where we can use this like any application where we use this.
@sandeepvoonna182
@sandeepvoonna182 6 жыл бұрын
If you call the openBrowser method from another class, then it will create anothe webdriver ??
@saikumara6384
@saikumara6384 6 жыл бұрын
Hi naveen..very informative and useful videos..you are really doing a great job and very good explanation. Could you please make a video on about Ant build tool and how to implement Ant in TestNG framework. Thanks in advance!!!
@mr_wasekar_sandip5314
@mr_wasekar_sandip5314 5 жыл бұрын
Hello naveen sir i have a one quetion how to implement thread safe webDriver instance using threadlocal class please create on video for me please ...
@lokeshsharma-gd1xo
@lokeshsharma-gd1xo 6 жыл бұрын
Hi Naveen, I had one query, Let say in TestFolder, My project contains 40 Test cases, and i m using Page object model, Do i need to use Local Webdriver instance for every test case
@khosruvai
@khosruvai 4 жыл бұрын
in singleton concept, yes!!
@sahilsayyad8144
@sahilsayyad8144 3 жыл бұрын
instead of using string to check new object is created or not u should use hashCode()
@yuvaj9730
@yuvaj9730 6 жыл бұрын
Hi naveen, When will u start Mobile App Testing using Appium.
@vaibhavsinha1243
@vaibhavsinha1243 6 жыл бұрын
What if for next teat case we need To invoke IE browser.. then hiw to proceed??
@anoopgarg1970
@anoopgarg1970 4 жыл бұрын
Nice Video, but why Constructor is declared private? Pls explain
@himalaycharpe6661
@himalaycharpe6661 2 жыл бұрын
Because ..only 1 object call krna hai...single tone me ..other isme se acces nahi hona chahiye constructor...so private ..
@bhargavi3884
@bhargavi3884 6 жыл бұрын
Output is one-time only
Difference between Interface and Absract Class
30:52
Naveen AutomationLabs
Рет қаралды 182 М.
This and Super keywords with Constructor Examples In Java
57:03
Naveen AutomationLabs
Рет қаралды 84 М.
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 4,9 МЛН
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 5 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 14 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 32 МЛН
🔥Singleton Design Pattern in Detail | Multi-Threaded Environments  | Hindi
25:59
Learn Code With Durgesh
Рет қаралды 100 М.
13. Java Singleton and Immutable Class Explained with Examples | Java Classes in Depth - Part4
28:26
What is Method and Method Overloading in Java
43:18
Naveen AutomationLabs
Рет қаралды 24 М.
What is Singleton Pattern in Java - How to achieve this?
15:21
Naveen AutomationLabs
Рет қаралды 20 М.
How to BREAK and FIX Singleton Design Pattern | Interview Question
19:32
Daily Code Buffer
Рет қаралды 33 М.
ArrayList: Java Collections Framework Tutorial Part 2
42:03
Naveen AutomationLabs
Рет қаралды 185 М.
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 4,9 МЛН