0% found this document useful (0 votes)
102 views6 pages

Playwright With Java

Playwright is an automation tool developed by the Puppeteer team that supports Chromium, WebKit, and Firefox through a single API across multiple operating systems. It features automatic waits, assertions, tracing, and a browser context mechanism for isolated sessions, allowing for fast execution and parallel testing. Additionally, it includes a code generation tool and debugging capabilities, making it a powerful option for web automation.

Uploaded by

surya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views6 pages

Playwright With Java

Playwright is an automation tool developed by the Puppeteer team that supports Chromium, WebKit, and Firefox through a single API across multiple operating systems. It features automatic waits, assertions, tracing, and a browser context mechanism for isolated sessions, allowing for fast execution and parallel testing. Additionally, it includes a code generation tool and debugging capabilities, making it a powerful option for web automation.

Uploaded by

surya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Playwright with java :

Playwright came from puppeteer dev team

PlayWright can be used to automate chromium, webkit, firefox using a single API

Linux, MACOS, WQINDOWS

Pythin, .net java

Playwright official website :

No waits required, automatic waits and synchronization

Assertions –

Tracing – capture screenshots, configure test retry strategy, eliminates flaky tests,

Pierce shadow frames, iframes

Fast execution, full isolation

Runs on a browser context mechanism

What is browser context mechanism : In playwright, browser context mechanism is like an incognito
session window which is separate for each context.

Like if we do parallel tests, in a sinle browser

Codegen : Records the actions and generates the test with any language

Open source

Session 2 : Cypress vs Playwright comparision :


Page 1 can be logged in with user 1

Page 2 can be logged in with user 2

Multi window support

Playwright architecture – Session 3 :


WebSocket protocol :
Once a connection is established bwn client and server, then we can send all the requests in the
same connection without terminating bwn.

If we close the connection, from either client side or server side, then only it will terminate.

Making the test execution faster.


Play wright Architecture :

Py.click()

This command is executed in node.js (a java script runtime env)

Then it will send the command to playwright library(API)

Then the playwright will modify these commands to low level browser language via browser protocol
(CDP)

Then the browser will perform the actions

And send the response back.

First script :

PlayWright session 6 :

Codegen inspector, playwright debugger

In order to launch the inspector, in the CLI run this command :

mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen


https://www.marvell.com/"

And then click enter, and then the codegen inspector gets launched and u can record ur actions and
the code gets generated in all the languages and u can copy that to ur class file
Debugging :

In order to debug, run as configurations, there add variable as :

PWDEB , value as 1 and click on apply

Now the playwright inspector will run and then the debug is running, u can stop near every step and
run and then check.

And in this stage as well u can do the record and play.

This is an amazing feature of playwright.

Session 7 :

Playwright tracing :

Locators :

Text locators :

Page.locate(“text=Sneha”)

Session 11 : Frames , iframes :

Whenever we are entering into an iframe, then all the elements present inside has to be referred
using that iframe only.

Else how the page will know inside which iframe, the element has to be searched for

You might also like