560 questions
1
vote
1
answer
320
views
Why use await and wait_for() in the same line in Playwright?
I am following an online tutorial for scraping with Playwright (https://jsoma.github.io/advanced-scraping-with-playwright/). There is one line that uses both await and wait_for(), and I don't ...
3
votes
0
answers
214
views
How to run pytest.playwright tests on a dash app wtith multiple simulated users as load test
I'd like to test my minimal dash app:
from dash import Dash, html, callback
from dash.dependencies import Input, Output
import dash_bootstrap_components as dbc
from time import sleep
app = Dash(...
3
votes
1
answer
2k
views
How to scroll inside a web element using Playwright Python
I have a web page with several components and one of its components is a panel (with a scroll bar) consists of 20 options in total, as given below:
Panel
When the web page loads, only first 7 options ...
0
votes
0
answers
359
views
Page loads with Playwright, but fails with scrapy-playwright
TL,DR;
When page is loaded by headless playwright + proxy it works perfectly, every time.
When page is loaded by scrapy-playwright, also headless and same proxy, it raises Timeout errors and the HTML ...
1
vote
0
answers
458
views
How to execute thousands of requests using both Concurrency and Parallelism using playwright with python?
I am currently on a crossroad whether to use AsyncIo or AsyncIO and multiprocessing. I stumbled upon an external python package called aiomultiprocesswhich simplifies the use of both AsyncIO and ...
0
votes
1
answer
37
views
can't change date picker to wanted date?
I wrote a script to log in, navigate to the report page, choose dates, and download the file. However, I’m facing an issue: the date picker always returns today’s date, regardless of the format I use !...
0
votes
2
answers
101
views
ImportError: cannot import name 'cache' from 'RPA.core.webdriver'
I am creating a webscraper and the idea is to use Selenium, Robocorp and VSCode altogether.
I understand that Robocorp already has a file YAML that contains de dependencies of the code, but my doubt ...
2
votes
1
answer
361
views
Python playwright locator not returning expected value
I'm not getting the expected value returned from the below code.
from playwright.sync_api import sync_playwright
import time
import random
def main():
with sync_playwright() as p:
browser ...
3
votes
1
answer
1k
views
Playwright - issue with the footer template parsing
Playwright (Python) save a page as PDF function works fine when there's no customisation in the header or footer. However, when I try to introduce a custom footer, the values don't seem to get ...
2
votes
0
answers
216
views
Method `new_page` of `BrowserContext` doesn`t work as expected in `Playwright`
I use playwright with pytest. Here are content of my coftest.py file and file with tests test_keplr.py. For some reason, method new_page works as expected in fixture context_use_args_async, but fails ...
2
votes
2
answers
5k
views
Playwright Sync API inside the asyncio loop
So this is my first time with Playwright so I thought to try out the examples only to find none of the work and the errors dont make sense:
I have tried all the examples in the docs and on the github ...
1
vote
1
answer
1k
views
How to get playwright page url
I am trying to get the current page url in python and playwright.
I have tried:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=...
0
votes
1
answer
52
views
Getting response.status and response.url from the site visited
I am trying to get the page.url, response.url and response.status from the websites. This is what I am trying:
from playwright.sync_api import sync_playwright
def scrape_page(url):
with ...
0
votes
1
answer
1k
views
Running pytest playwright script in headed mode from the command line
I am trying to run some script in headed mode from command line but its always running in headless mode. The thing is when I am directly running the class from the pycharm IDE, its successfully ...
0
votes
1
answer
136
views
In the Playwright web automation framework, is there a method that can help me handle elements that require scrolling to be clickable?
If the element is currently visible, such as the following:
I only need to execute page.get_by_text("target_string").click() to complete the click.
However, if an element is currently ...
2
votes
1
answer
2k
views
When using a custom Playwright-Python browser context, how to take fail case screenshots using Pytest?
Recently introduced to test automation I have been using Playwright-Python to create tests for our small team's SaaS portal. Code below has been simplified and rewritten using saucedemo. Our use case ...
0
votes
1
answer
867
views
can't able use background-color css in playwright
i am not able to use background-color css property in python template using playwright package firstly,i tried apply inline css style="background-color:red", secondly used script tag,using ...
2
votes
1
answer
66
views
Defined Rules get not called in Scrapy
I am currently working with the Python library Scrapy and I am inheriting from the CrawlSpider so that I can override/define custom Rules. I have defined rules that should block all URLs with auth/ ...
2
votes
0
answers
337
views
Is there a simple way to specify xvfb-run when using VSCode's debugging function?
I would like to debug E2E tests using playwright (python) in codespaces on github.
On Docker, I use "mcr.microsoft.com/playwright/python:v1.45.0" image and the headless operation is ...
5
votes
1
answer
358
views
Find direct children after tag "get_by_test_id"
I'm using playwright for testing web pages. When I use id tag as locator, I can find direct children of tagged div:
page.locator('#id_tag > div').all()
Now I try to use test_id tag and I need to ...
1
vote
0
answers
508
views
How to get specific cookies in Playwright on Python? [duplicate]
import asyncio
import re
from playwright.async_api import async_playwright, Playwright, expect
async def geochange(playwright: Playwright):
chromium = playwright.chromium
browser = await ...
2
votes
0
answers
1k
views
Target page, context or browser has been closed' with multiprocessing and sync_playwright in python
I have a problem that I have not been able to solve. The DispatcherServiceclass is the class that controls the other two, theoretically it should query an instance of a mongo base, retrieves a cookie ...
0
votes
0
answers
132
views
the location of the Python Playwright source code where the browser is launched
This is a python playwright source code debug problem.
I set breakpoints for debugging, but I can't trace the line of code where the browser is launched.
Here's the final position in the code where, ...
0
votes
2
answers
354
views
How to Check Bookmark URLs in Parallel Using Playwright with External Browser Connection
I have a task where I need to validate up to 1000 bookmark URLs using Playwright. I need to check the validity of these URLs in parallel (ideally 3-5 concurrent checks). I'm using an external Firefox ...
0
votes
1
answer
247
views
Selenium driver.get_cookies() is returning empty list []
I used Selenium to successfully log in to a portal. However, when attempting to extract cookies, I received an empty list. Interestingly, I noticed the cookies are visible in the network tab but are ...
2
votes
0
answers
818
views
Playwright-Pytest Error: It looks like you are using Playwright Sync API inside the asyncio loop
I am able to run testcases individually using pytest and the class, function fixture: pytest test_fixtures_class.py.
But when I try to run all classes testcases using the pytest command, I get the ...
0
votes
1
answer
134
views
How to extarct the google's buttons element via playwright?
I have a code snippet to extract the inputable and clickable node elements (i.e. interactive elements) from the DOM tree of the web pages via Playwright in python.
This code almost works properly but ...
4
votes
2
answers
584
views
Unable to fix this playwright error: ValueError: The future belongs to a different loop than the one specified as the loop argument
Getting this error:
ValueError: The future belongs to a different loop than the one specified as the loop argument.
Future exception was never retrieved
future: <Future finished exception=...
1
vote
0
answers
50
views
How to trigger a long-press JS initiator?
I am a junior programmer who recently began exploring Playwright in Python (still not familiar with JavaScript).
I am attempting to create a ChatRoom robot for non-threatening purposes (i.e., legal, ...
0
votes
1
answer
422
views
I have created a script to check a checkbox. After clicking on the checkbox, a new tab opens, but the checkbox remains unchecked
I want to automate the signup process but I'm unable to check the box using Playwright. Each time I click on the checkbox, I am redirected to a new link. In the DOM, when the checkbox is checked, the ...
1
vote
1
answer
109
views
Locator visibility timeouts when scraping hotel search results
My updated code after incorporating feedback (I specified different HTML class for some fields because the output I got did not look quite right:
import json
import time
from playwright.sync_api ...
2
votes
0
answers
926
views
Playwright contexts over websocket not working
I'm spawning Playwright on my local machine in one codebase, then connecting to it over websocket in another codebase (also on my local machine). The server is being spawned fine, and as it's not in ...
2
votes
1
answer
3k
views
Error in playwright python installation Ubuntu 24.04
I am trying to install playwright on my machine running Ubuntu 24.04 but I got this error
playwright install ...
0
votes
0
answers
55
views
Scrapy spider running even if its closed
So the spider is running even after it is closed, it keeps on dumping stats 0 items/min
2024-06-03 20:04:11 [scrapy.spidermiddlewares.depth] DEBUG: Ignoring link (depth > 5): https://www.raceentry....
0
votes
0
answers
332
views
Access the content of a blob URL
I am trying to get access to the binary data stored in a blob URL within Firefox.
The URL is in the format blob:https://basedomain.com/blob-url.
I am on page https://basedomain.com/current-page/, ...
0
votes
1
answer
182
views
KeyError: 'playwright_page'
async def errback_close_page(self, failure):
page = failure.request.meta["playwright_page"]
await page.close()
def start_requests(self):
if not self.start_urls and ...
0
votes
1
answer
454
views
Playwright Python: 'retain-on-failure'
For Node.js it's mentioned option 'retain-on-failure' (https://playwright.dev/docs/videos) to preserve only videos for failed tests. Nothing similar for the Python. How can it be solved (delete videos ...
0
votes
0
answers
278
views
Getting error while running Robot framework script using Browser library
I have recently installed nodejs, robotframework-browser and python on my system. I have test cases running fine in jenkins but when i am running in my local i am getting an error:
ERROR ] Calling ...
2
votes
0
answers
2k
views
Playwright Async Python: "target page context or browser has been closed" Error [duplicate]
I am trying to crawl dynamic content from a website using Playwright in an asynchronous Python environment. However, I keep encountering the error: target page context or browser has been closed. ...
1
vote
1
answer
462
views
playwright default timeout in pytest
In node.js we have https://playwright.dev/docs/test-timeouts, but page does not exist for python, I can use the timeout parameter, but then I have to set it all over:
page.goto(url, timeout=6000.0)
...
1
vote
0
answers
2k
views
Python: headless mode in Playwright doesn't work
I have a really strange problem: starting my program with this headless=False option everything works correctly, pages are opened, buttons are clicked, in a nutshell Playwright does its job. As soon ...
0
votes
0
answers
181
views
Can't implement playwright in behave steps file
So In steps file I wrote this code and it just stops. Nothing really happens. It opens and closes down in seconds, I can't understand why?
Error: raise Error("Event loop is closed! Is Playwright ...
-1
votes
1
answer
2k
views
page.type() works but locator.fill() times out, I'm trying to understand why
I tried using the playwright python locator.fill() method on a web element, and its timing out. I found another way to interact with an input element that works. I'm just trying to understand why.
...
-1
votes
1
answer
850
views
what does exactly get_by_text return in playwright?
I have already read the documentation but I'm still kinda confused about get_by_text method in playwright python:
I have a small code demonstration that I try to get the selector of the text Sr. ...
0
votes
1
answer
426
views
I try to use scrapy playwright to scroll through a web shop in order to scrape all products but it doesn't work
I am trying to click on the load more button until it disappears and all products are loaded. Then I want to click on all individual products to scrape the data I need from the products individual ...
2
votes
0
answers
119
views
Is it possible to change proxy "on fly" with python playwright?
For some testing reasons i need to enter site with one socks5 proxy and then change proxy to another socks5 proxy without closing browser or page. Is it possible on playwright?
Don't find any leads in ...
1
vote
1
answer
2k
views
Playwright Python: expect(locator).to_be_visible() vs locator.wait_for()
Is there a difference between expect(locator).to_be_visible() and locator.wait_for()? Should I prefer one over the other?
I've looked up the __doc__s:
wait_for: Returns when element specified by ...
0
votes
1
answer
492
views
Playwright Trying to hover multiple items by get_by_text() method
I am trying to find every message that contains "Hello team , here is a new report task:" text in a website and hover them one by one to be able to click another button.
page.get_by_role(&...
0
votes
1
answer
3k
views
How to get tagName in playwright python
I want to get the tagname tagName of element selector selected by get_by_text() method
for example :
element = page.get_by_text("example", exact=True)
1
vote
1
answer
568
views
Playwright Python is not getting the response
When I wait for a response from an API call that is made on a page, PlayWright never gets the response. I've seen this in several attempts to wait for a response on different pages but here is some ...