In Selenium 4, there is an Interface for Chrome DevTools API that lets you play with DevTools.
Here is a list of few things that we can achieve by using DevTools API with Selenium:
1. Use Console capabilities
2. Emulate network conditions
3. Perform security operations
4. Get performance and Metrics of our Browser/Network
The complete API can be found here: https://lnkd.in/f7ffwZq
Showing below how we can listen to Chrome Console logs and close the browser using the "Devtools" interface.
public static void chromeDevTools() throws InterruptedException, IOException {
try {
chromeDevTools = driver.getDevTools();
chromeDevTools.createSession();
message = "Hi everyone, this is Dheeraj.";
driver.get("https://lnkd.in/fM5JmnZ");
// execute Script to write console message
driver.executeScript("console.log('" + message + "');");
}
catch (Exception e) {
e.printStackTrace();
}
finally {
// Close browser gracefully.
chromeDevTools.send(new Command<>("Browser.close", ImmutableMap.of()));
}
selenium4 seleniumautomation automationtesting testing testAutomation
Clipboardy is a popular Node.js library that provides a cross-platform solution for interacting with the system clipboard. It supports both synchronous and asynchronous operations, and it can be used to copy, paste, and read the clipboard contents. Features of Clipboardy: 1. Cross-platform compatibility: It works on macOS, Windows, Linux, OpenBSD, FreeBSD, Android with Termux, and modern browsers. 2. Synchronous and asynchronous operations: It provides both synchronous and asynchronous methods for clipboard operations, making it suitable for a variety of use cases. 3. Copy, paste, and read operations: It supports copying, pasting, and reading the clipboard contents, making it a versatile tool for interacting with the clipboard. 4. Promise-based API: It is an asynchronous method that returns promises, making it easy to handle asynchronous operations in a clean and concise way. 5. Easy to use: It has a simple and intuitive API that is easy to learn and use. How to Use Clipboardy: To...
Great Post with valuable information. I am glad that I have visited this site. Share more updates
ReplyDeleteSelenium Online Training
Google Analytics Online course
Excellant post keep sharing and worthy information.
ReplyDeleteAngularjs Training in Chennai
Angularjs Certification Online
Angularjs Training In Bangalore
This post is so interactive and informative.keep update more information…
ReplyDeleteSoftware testing training in Anna Nagar
Software testing training in chennai