Chrome Console Logs using DevTools

Selenium 4: New Features Selenium 4 - New Featues
18 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€46.61
List Price:  €65.26
You save:  €18.64
£39.96
List Price:  £55.95
You save:  £15.99
CA$68.39
List Price:  CA$95.75
You save:  CA$27.36
A$76.59
List Price:  A$107.23
You save:  A$30.64
S$67.96
List Price:  S$95.15
You save:  S$27.19
HK$391.36
List Price:  HK$547.94
You save:  HK$156.57
CHF 45.64
List Price:  CHF 63.91
You save:  CHF 18.26
NOK kr547.39
List Price:  NOK kr766.40
You save:  NOK kr219
DKK kr347.66
List Price:  DKK kr486.75
You save:  DKK kr139.09
NZ$83.90
List Price:  NZ$117.46
You save:  NZ$33.56
د.إ183.60
List Price:  د.إ257.06
You save:  د.إ73.45
৳5,478.47
List Price:  ৳7,670.29
You save:  ৳2,191.82
₹4,165.48
List Price:  ₹5,832.01
You save:  ₹1,666.52
RM238.82
List Price:  RM334.37
You save:  RM95.55
₦63,338.32
List Price:  ₦88,678.72
You save:  ₦25,340.40
₨13,897.67
List Price:  ₨19,457.85
You save:  ₨5,560.18
฿1,850.91
List Price:  ฿2,591.43
You save:  ฿740.51
₺1,624.82
List Price:  ₺2,274.88
You save:  ₺650.06
B$257.30
List Price:  B$360.25
You save:  B$102.94
R950.48
List Price:  R1,330.75
You save:  R380.27
Лв91.20
List Price:  Лв127.68
You save:  Лв36.48
₩68,703.94
List Price:  ₩96,191.02
You save:  ₩27,487.07
₪189.75
List Price:  ₪265.67
You save:  ₪75.91
₱2,888.99
List Price:  ₱4,044.82
You save:  ₱1,155.83
¥7,775.71
List Price:  ¥10,886.62
You save:  ¥3,110.91
MX$852.59
List Price:  MX$1,193.70
You save:  MX$341.10
QR182.06
List Price:  QR254.90
You save:  QR72.84
P692.34
List Price:  P969.33
You save:  P276.99
KSh6,723.65
List Price:  KSh9,413.65
You save:  KSh2,690
E£2,394.34
List Price:  E£3,352.26
You save:  E£957.92
ብር2,838.38
List Price:  ብር3,973.96
You save:  ብር1,135.57
Kz41,866.62
List Price:  Kz58,616.62
You save:  Kz16,750
CLP$47,624.47
List Price:  CLP$66,678.07
You save:  CLP$19,053.60
CN¥362.22
List Price:  CN¥507.14
You save:  CN¥144.92
RD$2,935.86
List Price:  RD$4,110.44
You save:  RD$1,174.58
DA6,715.26
List Price:  DA9,401.90
You save:  DA2,686.64
FJ$114.57
List Price:  FJ$160.42
You save:  FJ$45.84
Q388.02
List Price:  Q543.26
You save:  Q155.24
GY$10,449.73
List Price:  GY$14,630.45
You save:  GY$4,180.72
ISK kr6,996.60
List Price:  ISK kr9,795.80
You save:  ISK kr2,799.20
DH506.56
List Price:  DH709.23
You save:  DH202.66
L890.37
List Price:  L1,246.59
You save:  L356.22
ден2,871.51
List Price:  ден4,020.35
You save:  ден1,148.83
MOP$402.79
List Price:  MOP$563.94
You save:  MOP$161.15
N$957.24
List Price:  N$1,340.22
You save:  N$382.97
C$1,837.34
List Price:  C$2,572.43
You save:  C$735.08
रु6,654.43
List Price:  रु9,316.74
You save:  रु2,662.30
S/185.19
List Price:  S/259.29
You save:  S/74.09
K189.75
List Price:  K265.67
You save:  K75.91
SAR187.49
List Price:  SAR262.50
You save:  SAR75.01
ZK1,304.12
List Price:  ZK1,825.88
You save:  ZK521.75
L231.95
List Price:  L324.76
You save:  L92.80
Kč1,174.43
List Price:  Kč1,644.30
You save:  Kč469.86
Ft18,295.47
List Price:  Ft25,615.12
You save:  Ft7,319.65
SEK kr543.08
List Price:  SEK kr760.35
You save:  SEK kr217.27
ARS$43,653.36
List Price:  ARS$61,118.20
You save:  ARS$17,464.83
Bs344.96
List Price:  Bs482.97
You save:  Bs138.01
COP$194,549.13
List Price:  COP$272,384.35
You save:  COP$77,835.21
₡25,038.42
List Price:  ₡35,055.79
You save:  ₡10,017.37
L1,232.29
List Price:  L1,725.31
You save:  L493.01
₲370,833.91
List Price:  ₲519,197.15
You save:  ₲148,363.23
$U1,917.12
List Price:  $U2,684.12
You save:  $U767
zł201.11
List Price:  zł281.58
You save:  zł80.46
Already have an account? Log In

Transcript

Hello, everyone, in this video session, I am going to explain part in Selenium for that is listening to Chrome console logs using chromium dev tools. So you have to first understand what exactly are this Chrome dev tools? Okay, first, you have to know what exactly are Chrome dev tools. So here, let me visually show you let me open any application in any browser safe Chrome, how to open in Chrome, because I will explain about Chrome Dev Tools only. I will open this application in Chrome browser. And in order to get the Chrome dev tools from datas will come by default in the application space, okay.

You don't have to install in the Chrome browser, we will get the Chrome Dev Tools by default. You don't have to install anything, no SQL key on your keyboard and when you press your field key You see some options got displayed here, from here to bottom, right? These are nothing but the Chrome Dev Tools. They have many tabs. And there are a lot of sub tabs and a lot of options are there guys, using which you can edit anything on the fly? Okay, so it's, it's like Chrome Dev Tools has a lot of options, guys, that's fine.

And come into the console as we have to, in this video session, we have to focus more on the console. Okay. Chrome console. In console, some locks will be displayed. So what I mean to do, sadly, is clear this clear this locks, okay, the console and set this log level to all okay, if it is like this, select this verbose option. By default, it may be like this, okay?

So just select verbose so that you will see all levels. Now, let's say this is a sample application like my.blogspot.com. So let me browse this application. As you can see, a lot of locks are getting displayed under these console logs, right. So a lot of doors Dong Dong kind of locks are getting displayed here. So using this chromium dev tools, we can listen to this logs, okay, using this chromium, chromium dev tools, we can listen to this Chrome browser locks.

But here I am saying here I am saying chromium dev tools, but how can we listen to the chrome console logs? chromium is different from Chrome right? For that I have the explanation guys, okay. So, in Selenium for the chrome driver, class is extending chromium driver, okay. Class, Chrome driver class is extending the chromium driver. That is the reason says chromium driver.

Okay. I am this chromium driver has amazing Known as get dev tools, I'll show you practically for now just understand visually. So, this detective tools is one of the methods of this chromium driver and but as chromium driver chrome driver is extending this chromium driver, we can also use this get a dev tools for listening to the loss of the Chrome browser, okay for listening the loud locks of the Chrome browser. So, there is a at a high level there is let me show you practically so that he can understand it better. So open any Maven project rise which is already configured with this Selenium for Okay, already configured this Maven project with Selenium for here as you can see under the dependencies, we have the dependency tags for the Selenium for alpha three version. Now already configure it with and other dependency is also added here.

To know the details steps of how to create a Maven project and how to configure it with this differently. penances so go to my first video session guys where I have a first video session of this Selenium four videos, new features three video series, where I have clearly explained how to create a Maven project and how to configure it with Selenium for under the request of Okay, so once that is done, just go to any package and say new and say class here. And let me name this class as demo 10. And select this public static void Main option. And inside this class inside this main method, write down some, like, let's say, for now let's write down this thing. Okay.

WebDriver driver is equal to new chrome driver. Okay, so for the most important WebDriver interface and import the chrome driver class done nowadays, over the mouse on this chrome driver class, and press ctrl key on your keyboard and then Click, click with your mouse. Okay, let's click with your mouse by by holding the Ctrl key on your first thing is like you have to hover the mouse on this chromedriver then hold the Ctrl key on your keyboard. And then when you get this hyperlink kind of thing, just left click using the mouse, it will take you to the chrome driver class. So as you can see here, this chrome driver class is extending the chromium driver. Okay.

If you go to the older version of selenium, that is Selenium three. You go here and go to this download page. Now the official version of selenium is still Selenium three anyhow, as you can see Java doc is this is Selenium triggers and search for Chrome driver. Plus, this is about Selenium triggers. So here you see the chrome driver class is extending which class in the earlier Selenium three version chromedriver class was extending the remote Try overclass directly but the current one the Selenium for things for change. So as you can see here when you click on this chrome driver here it will take you to the chrome driver class.

You see chrome driver class is extending which class it's not remote. Okay, it's not a remote WebDriver days instead chrome driver classes extending the chromium driver class. Okay. Chrome driver classes extend in the chromium driver class if you again do the same thing like razor over Amazon the chromium driver class and hold the Ctrl press and hold the Ctrl key on your keyboard and left click using the mouse will take you to this place of chromium driver class now chromium driver classes extending the remote WebDriver Okay, so this is a difference guys that is in Selenium three in Selenium three driver is extending the remote WebDriver directly okay chrome driver is extending the remote web driver directly. But in Selenium four things got changed that is chrome driver is extending the chromium driver and okay chrome driver is extending bromium driver and chromium driver is extending remote WebDriver that is a difference race here in Selenium three chrome driver is directly extending the remote web driver, but in Selenium for Chrome driver is extending chromium driver, whereas chromium driver extending the remote web driver that is one of the difference.

So, anyhow, coming to the point here chrome driver is extending the chrome driver extending the chrome VM driver that is the first point right you click on this chrome driver chrome driver class is extending the chromium driver and if you go to this chromium driver, so this chromium driver has some methods, okay, just go down. You see, there's a method known as get doodles method of this chromium driver. Since chromedriver is extending the chromium driver, since chrome driver is extending the chromium driver, we can use this get a dev tools method of chromium trail, where chromium driver class along with the also with the chrome driver, because chrome driver is extending the chromium driver hence, get tools method of this chromium driver can be used with the chrome driver class. Okay. So here, Chrome driver, chromium driver has this get Dev Tools method, okay. Available for this class has Chrome Dev Tools method.

And as this chromium chrome driver is extending this chromium driver, we can use This game dev tools of chromium driver with the chrome driver, okay. Plus, since chrome driver is extending the chromium driver in Selenium four. So that is one of the things. Now, guys, let's so now that's it, theoretical party's done. So what I'm going to do here is I'm going to practically demonstrate now, how to use this. Get deltas method, okay, of chromium doodles to listen to the locks of the Chrome browser console locks.

Okay. Listen to the Chrome browser console logs. Using this get Dev Tools method, we are going to listen to the Chrome browser console logs that I am going to practically demonstrate now. Okay, for that open Eclipse ID. Let's close all this stuff. And here before this WebDriver driver is called New chrome driver let's add driver manager thought chromedriver dot set up.

Then after that, driver dot manage dot window dot, maximize a browser window, then driver dot timeouts, okay, just implicitly wait. Time unit dot seconds, these are the basic steps how to provide for any script anyhow. So then driver dot get copy this application URL and paste it here. Before this is done, okay before driver dot gate is then I will write down some steps to liaison to the chrome console logs using Chrome Dev Tools. Okay, chromium doodles using this game, get Dev Tools method. So for that, guys, these are the steps, okay?

Steps to listen to the Chrome browser. Console logs. Let me write that here. First thing is that how to catch the driver. Okay, this chrome driver how to cast with this chrome driver class like this, then say dot get Dale tools, as I already mentioned, get deltal scissor method of the which class Chrome, chromium driver class, right chromium driver class. This chrome driver is extending the chromium driver, we can use this dedos with chromium chrome driver.

That's why I'm able to use this gatos method with Chrome driver class. Okay, so when I hold them all that is written in the doodles this Altos Hills, I'll set this equal to. This is like a Chrome Dev Tools, okay, are the most important videos from Selenium doodles. Done. Now the first thing that we have to do is to set the autos dot create session. So what is the purpose of this method do to create session method?

It is to create a Chrome Developer Developer Tools session, you're starting a Chrome Dev Tools session base. Okay. Then after starting this Chrome Dev Tools session, we can perform operations on this Chrome Dev Tools. Like one of the operation is listening to the chrome console locks is one of the operations in order to listen to this chrome console logs. We have to first create the session for this Chrome Dev Tools. Then, let's enable the loss.

Okay. Enable the Chrome Dev Tools, console logs. So for that dev tools, dot okay. There is a command method known as standard guys, using this send, you can exude some comments. Okay, you can do you can pass some commands case. Let's say one of the comment I wanted to pass this law dot enable Okay, this is one of the commands is using this command, okay.

Logout enable command by providing this logout animal enable command and send method of doodles, you can issue this command, so it will enable the locks. Okay, so that when you enable the logs, what it what will happen? You can listen to them, okay? is, in order to listen to the chrome console locks, we have to first enable the locks. Okay, we have to first start the Chrome Dev Tools session, then we have to enable the Chrome Dev Tools, console log, then what we have to do, we have to listen to the locks. Now the steps for listening to the Chrome Dev Tools, console logs.

So further dev tools, again, we have to use the same this time dot add listener here to say, Okay, we have to add the listeners. So now, log dot entry added. This is a syntax so how to use this okay now to listen to the Chrome Dev Tools console log, you have to say log dot entry added. Then dot entry added afterwards you have to say in three remark. Okay, and three remark and then we have to say System dot out dot print ln. I'm just remembering these four guys.

You don't have to remember that you can directly Okay, get it from this here. Okay? So here I have to say entry.as Selenium log in, okay. The more than seven extra semicolon. So anything missing here I'm doing any mistakes. Okay, it's asking me to change project complaints and JRE to one point eight okay okay.

So this lambda expression this is nothing but the lambda expression in Java guys so in order to you know not to make this work you have to use the Selenium Java eight versions okay so that's why it's asking us to change the project complaints and JRE to one by just selecting that so that will be resolved okay got resolved guys. Okay after I change the project complaints do JRE on pine gate the issue got resolved so it's lambda expressions are supported in from Java eight so that's the reason we have to do that okay. Now to set the confidence level to 1.8 or 1.8 right. Now, we are able to listen to the logs and whatever the last that are listen will be printed into your output Okay. Here it will be printed. So when this program got as you noted, in this output console of Eclipse ID, since we are using System dot out dot print ln here, it will add the log entry into this output console of Eclipse IDE.

Okay, so let me after, after creating the Chrome Dev Tools session And then after enabling the Chrome Dev Tools, console logs, and then listening to this and printing them, okay, then if you open this application, the application will be open and this kind of locks will come, right? This kind of locks will come and these locks will be designed by this. Get Dell tools, okay. And then we'll be there will be presented by this digital sign printed into the output console of this Eclipse IDE. So let's run this program. First.

We have this application driver dot gate. Okay, open application is getting open, this loss will come and this locks will be designed by this Chrome Dev Tools and printed enter output, Eclipse ID output console. So let's run this code. So it's opening the application URL. So that's it. And then let's go To the eclipse ID and see that in our in our output console.

The last card printed. Okay, these are the log space. So this eclipse Id love this Chrome browser dev console logs. These are the two locks that got designed by this dev tools of this. Okay by Delta's of the Chrome browser and printed into the output console of this eclipse ID here. Okay, this how this we have to use dev tools for listening to the Chrome browser console logs, okay, using this get Dev Tools method of this chromium class.

So like is guys, we can do many things. Okay, we can do is listening to Chrome console locks is one of the activities that we can do using this gators method of this chromium class. And we have in the next video session, the next video session I am going to explain how to use this get Delta's method of this chromium class to load in seconds. Your websites Okay, there are some options guys, which will help support in loading the insecure websites. So that thing anyhow I'm going to explain in detail in the next video session. So that's it guys.

See in the next video session. Thank you. Bye

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.