filmov
tv
✔ Selenium 4: How To View A Browser's Console Logs | (Video 163)

Показать описание
Selenium 4: How To View A Browser's Console Logs
Social Media Contact
► Transcript
There are 2 objectives for viewing a browser’s Console panel. First, is to execute JavaScript. Second, is to view messages logged by the browser or logged by the developer. In this session, our focus will be to view messages logged by the browser. Most of the times, we view the Console Logs to get details about an error. With those details, we can identify the root cause of the problem.
Our AUT is this lego page and CTRL + SHIFT + I is a shortcut to the Developer Tools panel. In the Console tab, we already have some logs because the page has already been loaded. We can clear the logs, reload the page, then watch the logs back show up. DevTool failed to load SourceMap and HTTP error Status Code 404. The DevTools class in Selenium 4 provides a way to listen to these logs which has 4 Log Levels: Verbose, Info, Warnings, and Errors.
Verbose is not checked for default. Therefore, the messages will not be wordy. It won’t have many words in the message. Info means the logs will have important information about an event. Warnings indicate a strange condition might cause a problem with operations. Errors let us know a condition is likely to cause a problem with operations. Now for our Test Script, chromedriver is setup and the window is maximized.
Start by writing @Test / public void viewConsoleLogs () { } Let’s add some steps but write them as comments: First we // Get The DevTools and Create A Session. Then, // Send A Command To Enable The Logs. Next, we // Add A Listener For The Logs. Finally, we // Load The AUT
In this screenshot, we see Alpha 6 does not have asSeleniumLogEntry for a method. Alpha 6 is not the most recent version. However, Alpha 6 and the most recent version added more methods although asSeleniumLogEntry is missing. Alpha 1 does not have methods getArgs, getLineNumber, getNetworkRequestId, getStackTrace, getUrl and getWorkerId.
Change level to text and getLevel to getText then level to timestamp and getLevel to getTimestamp.
#Selenium4 #ViewConsoleLogs
Social Media Contact
► Transcript
There are 2 objectives for viewing a browser’s Console panel. First, is to execute JavaScript. Second, is to view messages logged by the browser or logged by the developer. In this session, our focus will be to view messages logged by the browser. Most of the times, we view the Console Logs to get details about an error. With those details, we can identify the root cause of the problem.
Our AUT is this lego page and CTRL + SHIFT + I is a shortcut to the Developer Tools panel. In the Console tab, we already have some logs because the page has already been loaded. We can clear the logs, reload the page, then watch the logs back show up. DevTool failed to load SourceMap and HTTP error Status Code 404. The DevTools class in Selenium 4 provides a way to listen to these logs which has 4 Log Levels: Verbose, Info, Warnings, and Errors.
Verbose is not checked for default. Therefore, the messages will not be wordy. It won’t have many words in the message. Info means the logs will have important information about an event. Warnings indicate a strange condition might cause a problem with operations. Errors let us know a condition is likely to cause a problem with operations. Now for our Test Script, chromedriver is setup and the window is maximized.
Start by writing @Test / public void viewConsoleLogs () { } Let’s add some steps but write them as comments: First we // Get The DevTools and Create A Session. Then, // Send A Command To Enable The Logs. Next, we // Add A Listener For The Logs. Finally, we // Load The AUT
In this screenshot, we see Alpha 6 does not have asSeleniumLogEntry for a method. Alpha 6 is not the most recent version. However, Alpha 6 and the most recent version added more methods although asSeleniumLogEntry is missing. Alpha 1 does not have methods getArgs, getLineNumber, getNetworkRequestId, getStackTrace, getUrl and getWorkerId.
Change level to text and getLevel to getText then level to timestamp and getLevel to getTimestamp.
#Selenium4 #ViewConsoleLogs
Комментарии