Hello everyone, in this video session, I am going to explain part 11 of selenium for that is loading insecure websites using dev tools. So if you if you try to load some insecure websites like this, okay, who said fake ID? port certificates certificate is already expired. Okay, let me open this in a Chrome browser, this insecure website I am trying to access here. And I am going to get some error. Okay, security error, I'm getting certificate date invariant, that is a certificate got expired, it's saying.
So. So in such cases where we are not able to access the application, an application is not loading in place of the application, we are getting this certificate error saying that it's expired. So if you still want this application to be load, okay, if you still want this application to be loaded, despite of the certificate error if you want to load this insecure website, then Using this dev tools, we can do the race. So how to ignore the certificate errors using the dev tools. I am going to explain this current video session. So, before that guys before I practically demonstrate we have to find out about this gate Dev Tools method.
Okay. We are going to use this get deltas method guys, which is going to return this deltas class. So, so there is something about this gate doodles. Okay. So let me explain. What is that something in Selenium three.
In Selenium three. We have this chrome driver medically extending this remote WebDriver installation Selenium three, the chrome driver use is Directly extending the remote WebDriver right we show that so go to Selenium HQ dot o RG go to this download and if you come here there is something like Java and Selenium WebDriver version 3.14 that is Selenium three, this click on this Java doc and search for this chrome driver class and then click here. So now as you can see here this chrome driver class is directly extending this remote web driver. But coming to Selenium four, but coming to Selenium four it's different it is okay in Selenium for Chrome driver class is extending chromium driver class, which is actually extending the extending the remote WebDriver. In Selenium three chrome driver classes directly extend extending this Remote WebDriver whereas in Selenium for Chrome driver is extending the chromium driver which is extending the remote web driver okay.
So here chrome driver is extending the chromium driver in this Selenium four. So let's see that in the code actually. So, let me open Eclipse ID. And here we have a Mavin project guys, which is already created and it has it is already configured with this Selenium four, okay, alpha version of the Selenium four which is so far the latest as of today. So this Maven project is already configured with the Selenium four and other required stuff here. Okay, so assuming that you have this Maven project configured with the Selenium for us, it's not you can go to the video one of this Selenium for new features video series, we have clearly explained how to create a Maven project and how to configure it with Selenium for another request.
Okay. So hoping that you have created a Maven project with this by configuring it with the Selenium for another required stuff Okay, let's right click on this package name and say class and in this classes demo, we have something like 10 now, I will use something like 11 okay and select public static void Main. And now we have a demo level class inside that we have this main method inside that let me write a sample statement like this WebDriver driver is equal to new chrome driver, okay. For the most on this WebDriver and in Portage and who are the most on this chrome driver and in Portage, Now guys, this is Selenium for Okay in this project we have Selenium for this project is configured in Selenium for so we have imported this WebDriver from Selenium for and this chrome driver class from Selenium for Okay, now, for the mode on this chrome driver class, press the Ctrl key on your keyboard.
Hold it up. Hold the key, for the most is the Ctrl key on your keyboard and hold it and then left click mouse left click on this hyperlink kind of thing, okay. And you do that it will take you to the chrome driver class of selenium four. You can see here from driver class here is extending the chromium driver. Okay. Chrome driver classes here, extending the chromium driver, as I said here in selenium, Google Chrome driver is not directly extending the remote repair instead of Chrome driver is extending the chromium driver.
Now let's move ahead. Again, do the same thing over the mouse on this chromium driver, press, press, press and hold the Ctrl key on your keyboard and click this chrome driver left click the mouse left click this chrome driver. Now you can see here we have been taken to the chromium driver class which is extending the remote web driver. Okay, premium Time passes extending the remote WebDriver. And in this chromium driver class if you go down a bit Okay, you will find a method known as give to get deltas method which will return you the dibbles Okay, we need just Delta's class days variable of this delta class for that we need to call this method okay of this chromium driver. So, we have to this get get derivatives method which will return you as the deltas class.
But guys this get to tools method inside which class chromium driver class, okay, get Delta's methods inside which class inside the chromium driver class, okay. But guys, since chrome driver is extending this chromium driver, we can also use this get dev tools with this chrome driver. Okay. Even though the get Dev Tools method is belongs to the chromium driver, since Chrome, the chrome driver is extending the chromium driver, we can use the data tools method with a chrome driver also. Okay, so That's the thing we have to know. Okay, these are things we have to know before proceeding guys.
So let me start practically demonstrating how to load insecure website using dev tools. Okay, so let's start this let's write some basic steps like WebDriver manager dot chromedriver dot set up. Then I will say driver dot manage maximize the browser window. Driver dot manage dot timeout start implicitly wait for some time. Time unit dot seconds done right now guys, before I open any insecure applications, let me okay do few things like ignore the certificate and at all. Okay, the first step here is we have to first create a demo session in order to use that to do your first created doodle session.
First we need to do tools right we need to do tools and only we can create a session. So let's okay let's do something like this cast the driver okay with the chrome driver class as this driver with this chrome driver class then you will get this a double dose method okay? Get double dose method you are able to use this get DevTools method it's chrome because chrome driver is class is extending which class chromium driver where this get method is available. Okay. So this is the index and for the mouse on get tools, it will return you the devils class. Now we got the deal tools.
Okay, using this dev tools. We are going take notice certificate error, import this to dues from Selenium. Now, first thing is that before actually we go to the site, ignoring certificate and all the first thing that we need to do is we have to create a digital session. Okay, we have to create a digital session then only we can Notice I forget and all okay create Dev Tools session for that what do you have to do? How to take this doodles dot create session Okay, it will create the doodle session once the doodle session is created, we have to enable the security guys okay. We have to enable the security for that we have to say Dev Tools dot send the command send command is one of the commands of this Dev Tools using which we can provide any comments we can issue the comments here okay.
So something like security dot one of the commands that I want as a good is security dot enable, okay. So this is a command and if I provide this command in the Send method will execute it Okay, the comments in our issue the commands will be used which methods and methods so here command is security or tenable, which enable the security of the application Now the next thing when the security is enabled then we have to ignore the certificate errors okay. So for that we have to use again do to dot again we have to use a command a send command and we need to issue the command life security dot okay said ignore certificate errors okay how to use this command security dot set ignore certificate errors we have to go through okay. So this will ignore the certificate errors even though you get some certificate errors on Rosing okay it will be ignored.
Now, once these three steps are done, let's load and inspect your website. So here I already explained this is an insecure website when you try to load this insecure website here. You are getting this certificate expired error, right. So I am going going to give the same thing here. Driver dot, which is giving the insecure website and before loading this insecure website have ignored the certificate error using this code. So if I run this, okay, if I run this the certificate will be error will be ignored and the original application will be loaded.
You can see that in the script now. Okay, this is possible with the help of the doodle space. Okay, the Chrome Dev Tools, we are able to do this enabled to ignore the certificate and load the application. Do you see the application has been loaded because we have ignored the certificate error. Okay, so this is how guess we can use dev tools. That is Chrome dev tools for ignoring the certificate errors.
This is one of the new feature in Selenium for guys. So that's it guys. In the next video session, I am going to explain Another new feature of selenium for that is your knowledge longer need any driver is suitable sir WebDriver manager is okay. So earlier you have to use you have to download some chrome driver DFC or IE driver, ESC and so on, okay to create to learn the browser signed on in selenium, but okay, I'm observing this from few days like, okay with the help of the Selenium four alpha three version and without any need of any driver as you develop a WebDriver. Manager, I will, I am able to, I'm able to learn the browsers, okay. We will launch and use the browsers.
So I will explain about these things in detail in the next video session. So that's it, guys. See you in the next video session. Thank you. Bye.