In this section, we will discuss about another advance feature of Selenium 4 is Chrome Debugging Protocol. Chrome Debugging protocol generally known as CDP which is the most important advance feature added in Selenium 4. Chrome Debugging Protocol helps user to work with Chrome properties like Fetch, Network, Profile, Performance, Application cache etc.
Chrome Debugging Protocol is the new features which comes with Selenium 4. Selenium actually supports Chrome Debugging Protocol through the DevTools Interface.
From the name, you can notice that the CDP only supports Chrome browser only. CDP provides APIs for set of Web Browsers tools through which QA and Developer can edit the page through scripts. Addition to edit, they can diagnosis faster.
This makes script efficient and faster. These APIs can be used for emulating Geo-Location and Emulating Network Location. We can use this features to test Geo location functionality.
Chrome DevTool is nothing but known as a developer tool and it is build in to Chrome browser. This tracks the progress on the browsers, diagnosis the problem or issues and provide the direct communication line. We can access this by doing “Right Click on the page and Click on the Inspect”.
There are multiple panel will be displayed when we do inspect on the page. Following are the list of them.
- Element: It will view the DOM and help to inspect the element. We can see the page as HTML format. Also we can inspect each element if required from Element
- Network: It deals with viewing and debugging activities in the network.
- Performance: This components monitors the load and runtime performance of a website.
- Memory: This components provides the information how a page uses the memory.
- Application: This component examine all the loaded Resources.
- Security: This is the one of the important component. It inspect the security of a web page by debugging issues.
- Light house: This component of Chrome audits the web application.
Do you know what is DevTools?
DevTools is actually a class. It helps to increase productivity with the following capabilities.
- Viewing the DOM
- Handling Developer option
- Adding Listener
- Creating a session
- Inspecting Network activities
- Emulating Network connection
- Measuring Performance
With DevTools APis, One can trigger DevTools command by using the test script. This is useful in accepting security warning appearing for website. DevTools class has all required methods that a tester can use to interact with the developer option. CDP is generally debug as a debugging rule.