Questions tagged [playwright-python]

Microsoft Playwright is a web automation library comparable to Selenium. This tag refers to the Python port of the library.

Microsoft Playwright is a web automation library comparable to Selenium. Originally a Javascript project, this is now also available in Python.

Related tags:

365 questions
5
votes
1 answer

Chrome - Automatically open devtools on network and perserve log

I am using playwright for test automation. Every test run creates a new instance of chromium. When I pass --auto-open-devtools-for-tabs it opens devtools as expected. But, I need to go one step further and have checkbox Perserve Log enabled. Tests…
5
votes
3 answers

In Playwright for Python, how do I retrieve a handle for elements from within an frame (iframe)?

I have successfully used Playwright in python to get elements from a page. I now ran into to challenge of getting elements from a document embedded within an iframe. As an example, I used the w3schools page explaining the
buddemat
  • 4,552
  • 14
  • 29
  • 49
5
votes
1 answer

Downloading pdf files using playwright-python

I'm trying to download PDF files that are rendered in a browser (not shown as a popup or downloaded) using playwright (Python). No URL is exposed, so you can't simply scrape a link and download it using requests.get("file_url"). I've tried: async…
FarNorth
  • 289
  • 1
  • 7
  • 16
4
votes
2 answers

How to authenticate using Windows Authentication in Playwright

I need to automate a test that uses Windows Authentication. I know that the the prompt that opens up is not part of the HTML page, yet why my code is not…
Tal Angel
  • 1,301
  • 3
  • 29
  • 63
4
votes
1 answer

Playwright, method "is_visible()" always returns False for the page title

I print out the title, then put it into the function "is_visible()" It always returns False, but it should be True since I use the title the computer returns to me. Any solution? from playwright.sync_api import sync_playwright from…
akuan10
  • 111
  • 6
4
votes
3 answers

Python - Playwright timeout

I'm using Playwright to upload a file and download the result. When the inputfiles are large, and it takes a long time to process I get a timeout from playwright; it takes to long for the button "Download" to appear. raise…
Tralala
  • 233
  • 2
  • 10
4
votes
0 answers

How to capture all console error logs playwright

I tried all of this, page.on("console", lambda msg: print(f"error: {msg.text}") if msg.type == "error" else None) page.on("console", lambda msg: print(msg.text)) page.on("pageerror", lambda exc: print(f"uncaught exception: {exc}")) Nothing…
morty7676
  • 73
  • 2
  • 7
4
votes
1 answer

Using Playwright for Python, how can I wait for a field / selector result to change

Using Playwright for Python, I want to wait for a change of content. I can get the content of a selector like this month = page.querySelector('.day__month_btn').innerText() In this example, I'm reading the month value of a datepicker element and…
576i
  • 7,579
  • 12
  • 55
  • 92
3
votes
2 answers

Importing playwright fails with "DLL load failed while importing _greenlet"

Why does this error appear in the playwright file? ImportError: DLL load failed while importing _greenlet: The specified module could not be found. Here is my code: from playwright.sync_api import sync_playwright with sync_playwright() as p: …
albob
  • 31
  • 3
3
votes
1 answer

Extract images from playwright page without requesting them again?

Let's say I've requested a page and it's fully loaded. Is it possible to save the images from the rendered/loaded page without sending another request for the image? This would be to avoid just collecting the individual image urls and hammering the…
Zach Johnson
  • 2,047
  • 6
  • 24
  • 40
3
votes
1 answer

Python-Playwright: Is there a way to introspect and/or run commands interactively?

I'm trying to move from Selenium to Playwright for some webscraping tasks. Perhaps I got stuck into this bad habit of having Selenium running the browser on the side while testing the commands and selectors on the run. Is there any way to achieve…
LdL
  • 35
  • 3
3
votes
1 answer

How to get texts in iframe using query_selector_all with Playwright

I want to get text data from iframe on a webpage using Playwright with Python. As the data in the iframe, it does not work when I try use page.query_selector_all directly. For example, below works well, but it's not a solution I want. inner_text =…
ytchang
  • 31
  • 2
3
votes
2 answers

How to start playwright outside 'with' without context managers

I'm creating a web automation that I need to keep the browser open, but since playwright library only has the getting started showing the code including the "with" statement every time the script it's finished the browser close itself. I know I…
3
votes
1 answer

How to catch specific redirect using playwright?

when Google Map is to some level confirmed about a place search it redirects to the specific Google place url otherwise it returns a map search result page. Google Map search for "manarama"…
coolsaint
  • 1,291
  • 2
  • 16
  • 27
3
votes
3 answers

playwright headless chromium can't find selector, but finds it in UI mode

What I'm trying to do I am doing some e2e testing with playwright on a webapp The problem I am running into problems whenever I want to save resources with headless mode. My playwright script is working perfectly in chromium UI mode. When…
blkpingu
  • 1,556
  • 1
  • 18
  • 41
1
2
3
24 25