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
What is an ARIA Snapshot in Playwright? An ARIA snapshot in Playwright is a structured representation of a page’s accessibility tree , which is used by assistive technologies (e.g., screen readers) to interpret the content of a web page. This snapshot helps verify if elements have the correct roles, names, and properties required for accessibility. Playwright provides the page.accessibility.snapshot() API to capture this accessibility tree at any given moment during test execution. How Does ARIA Work? ARIA ( Accessible Rich Internet Applications ) is a set of attributes that help improve accessibility by defining roles, states, and properties for elements that are not natively accessible. Example: In this case, the aria-label ensures that screen readers identify the button as “Submit Form.” How to Use ARIA Snapshots in Playwright? Playwright’s accessibility.snapshot() method retrieves the accessible structure of the page. Ex...
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