For questions about the Playwright API for Java. This tag should be used in conjunction with the [playwright] tag.
Questions tagged [playwright-java]
83 questions
0
votes
2 answers
How to open a new Tab in Playwright in Java?
I used this piece of code but no luck, I get error waiting for selector
Page popup = page.waitForPopup(() -> {
page.click("a[target='_blank']");
});

Meghana
- 3
- 3
0
votes
0 answers
Page navigation using Playwright with JAVA running under AWS VPN connection not working
I'm working under AWS VPN connection and when I try simple page navigation to site that is under AWS VPN connection using playwright JAVA code, I'm getting timeout and the page navigation is not opening the site.
If I do it manually using Chrome…

ronbary
- 1
0
votes
1 answer
Java Playwright get response body of redirect
Im using https://github.com/microsoft/playwright-java.
This code:
final BrowserContext context = browser.newContext();
final Page page = context.newPage();
page.onResponse(response -> {
response.body();
});
gives the exception: Response…

user16910689
- 39
- 1
- 4
0
votes
0 answers
Playwright GRID (experimental Grid support) - How to use?
I am able to start the grid server and able to register the agents.
But below code is failing with 400 error.
Exception in thread "main" com.microsoft.playwright.PlaywrightException: Error {
message='WebSocket error: Unexpected server response: 400…

Sridhar Reddy S
- 121
- 2
- 13
0
votes
1 answer
Automate Tokens base login in Playwright. Java
Scenario : To login to the application, need to enter the username and token sent on register email id.
How can we automate above scenario in playwright using java language.
Thank you in advance.

Santosh
- 47
- 1
- 1
- 3
0
votes
1 answer
Playwright JAVA selector - recording vs regular
New to playwright, creating some sample stuff to find out how to use the tool.
From the image above, the getByRole works fine (while I recorded in playwright) but to get the xpath for this element it becomes like button/div and then using…

swame_sp
- 59
- 2
- 10
0
votes
1 answer
How to handle the wait for a event when clicked on a button which initiate an ajax call for playwright-Java
I am working on default nop Commerce 4.50 automation for my work. I am mainly facing problem when trying to add 2 products to compare list one after another. There is a loading icon when pressing the add to compare button. I have tried…

alfah
- 77
- 5
0
votes
1 answer
Storing and reusing the text content of an object using Playwright and Javascript, then use it for assertion/validaton
I would like to store the text from an object locator and use it for assertion. For instance, I have a trade number - 1234. This trade number only appears after a transaction, so it is not static on other screens. This number is located on several…

CherryBomb
- 1
- 3
0
votes
1 answer
How to record browser/system audio using Java/Playwright
I am currently using Playwright to interact with a webpage that makes calls to people. I need to record the call for the first 5 seconds and save the file locally for playback after execution. I cannot find a good solution for this anywhere. Any…

Lilpercy11
- 86
- 3
0
votes
2 answers
How to emulate WebRTC DNS leak IP using Playwright JAVA?
I am using Playwright for testing multi-account browsing therefore leveraging proxy and emulating geolocations, time-zone is useful. but some website eg: https://browserleaks.com/ip are still able to detect my public ip which is leads to DNS leak…
user19704235
0
votes
1 answer
How to read the selected value of a dropbox using Playwright Java
Could someone give me an example how to read the selected value/option from a dropdown?
I have tried this syntax (JAVA), but it returns all the options of the dropdown.
page.locator("//xpath to dropdown webelement").textContent()
I only want to…

lorenlai
- 51
- 7
0
votes
1 answer
Can we run IP based testing for geo location in playwright?
Playwright provides geolocation support using latitude and longitude, however it only changes location at client. In my use-case, I need IP address needs along with APIs and urls so fetch and render content based on IP address
0
votes
1 answer
Deserialise API Response of PlayWright using Java
I am exploring playwright for automating api tests and I am unable to deserialise APIResponse of playwright to a POJO using java. I used to do this with rest assured using following code:
PetStoreModel petStoreModel = …

Bilal
- 558
- 8
- 18
0
votes
0 answers
Java Allure Report - Playwright | how to take screenshot on test failure
Selenium : Take screenshot method:
" if (scenario.isFailed()) {
String screenshotName = scenario.getName().replaceAll(” “, “_”);
try {
TakesScreenshot ts = (TakesScreenshot) driver;
File sourcePath = ts.getScreenshotAs(OutputType.FILE);
File…

Shilpa k
- 1
0
votes
2 answers
unable to install playwright as a maven dependancy
I'm trying to build my automation framework using playwright with java, however I'm running into below issue when running the tests. Please advice!
Failed to install browsers
Error: Failed to download chromium v1000, caused by
Error: unable to get…

Dinesh
- 31
- 4