560 questions
0
votes
1
answer
877
views
Unknown engine "name" while parsing selector name=startcreateddate createStackless in Playwright [closed]
I have tried to identify the element using id or name in Playwright, but playwright throws an error:
"Unknown engine "name" while parsing selector name=startcreateddate createStackless&...
0
votes
0
answers
1k
views
fill() method doesn't work. Playwright/Python
I'm writing automated tests using Playwright in PyCharm. I have a method:
python
def fill_email_input(self, email="email_value"):
email_input = self.page.locator(SignInPageLocators....
0
votes
1
answer
426
views
Handling pagination in python playwright
I am trying to scrape this site https://booking.com with playwright and python
but I don't Know how to scrape through multiple result pages ,How do I solve this pagination problem? how can I loop over ...
0
votes
0
answers
314
views
Playwright Locator Issue
I am using Playwright trying to automate a button clicking action. I have tried to locate the HTML content through several methods, but will not click and proceed to the next screen.
Here is the HTML ...
0
votes
1
answer
2k
views
AWS Lambda fails when using Playwright to navigate browser (Python)
I have created an LLM agent with tools using Langchain and Python. I build my Lambda with with AWS SAM with Docker. After building, I test the Docker image using sam local invoke, and the Lambda ...
1
vote
0
answers
1k
views
Keep getting CAPTCHA every time playwright (trying to scrape Capterra reviews)
I've been trying to scrape reviews from Capterra and the code itself works fine but I have a problem where every time I launch a browser using playwright and go to Capterra website I get a Captcha (...
1
vote
2
answers
1k
views
Playwright to_have_values() - How to build a regex to assert a list regardless of list size and the position of the searched element within the list
I have this Playwright piece of code that selects options for a multi-select element
I use the expect() function with regular expressions in order to assert the presence of "xx-oranges" in ...
0
votes
1
answer
583
views
Converting request interception example from Cypress to Playwright Python
The Cypress project has a sample test on how to intercept and modify AJAX calls and I wanted to rewrite the same example in Playwright for Python (pytest).
The example consists on intercepting and ...
1
vote
1
answer
3k
views
Error in Playwright using Python: playwright._impl._api_types.Error: net::ERR_HTTP2_PROTOCOL_ERROR at
I'm learning a bit of web scraping using Playwright and Python, but I can't connect to the website I wish to using goto.
from playwright.sync_api import sync_playwright
def run(playwright):
...
1
vote
1
answer
95
views
How can rewrite the code with pure playwright codes?
I want to get all the a elements href attribute in the webpage https://learningenglish.voanews.com/z/1581:
from lxml import html
from playwright.sync_api import sync_playwright
with sync_playwright() ...
1
vote
1
answer
805
views
Playwright python code works locally with headless browser but fails in AWS Lambda
I have developed a Playwright script that successfully runs on my local machine using a headless browser, but when I deploy it to AWS Lambda, it doesn't work as expected. The Lambda function times out,...
3
votes
1
answer
2k
views
Can you Play a Youtube video using Playwright?
Just for educational purposes, is there a way to do it?
I ran:
playwright codegen demo.playwright.dev/todomvc
and got these:
page.locator("video").click()
page.get_by_label("YouTube ...
0
votes
1
answer
300
views
My headless browser works on its own, but fail when used as a FastAPI endpoint
I coded a class to use as a headless browser for my FastAPI app. The problem is the class works just fine when I use it directly, but it fails when used in a FastAPI endpoint.
Here's the class
from ...
2
votes
1
answer
3k
views
how to take fullpage screenshot using playwright
I'm new to browser automation
I'm trying to take a screenshot of a full webpage (example: https://www.apple.com/) using the below code
import time
from playwright.sync_api import sync_playwright
with ...
3
votes
1
answer
2k
views
How to make assertion of dialog.message in playwright?
In one of my tests I need to assert message in browser dialog.
I created dialog handler in test
page.on('dialog', BasePage.dialog_handle)
page is default playwright fixture.
The handler itself is
def ...
0
votes
1
answer
394
views
How to use chained page object locators?
I have a function, contains the page objects
class TemplateListPage:
def __init__(self, page):
self.list_first_row = self.page.locator(".grid-row").first
self.use_btn = self....
0
votes
0
answers
449
views
Cannot download file with scrapy-playwright
I was trying to download file via scrapy-playwright, but for some reason download of file fails. On URL there is pdf file that I want to download, and I can see from logs that download is started, but ...
2
votes
1
answer
1k
views
Python testing assertions (unittest, playwright)
so im new to testing and have been learning python/playwright testing for a couple of weeks now.
I've got to assertions and have found multiple ways to write them, so this might sound like a stupid ...
2
votes
1
answer
2k
views
How can I find pseudo element using Playwright?
In my webpage I have some pseudo elements.
For example:
How can I find the ::after element using Playwright?
2
votes
1
answer
757
views
How to pass a locator as a parameter on PageObject function using playwright?
I made BasePage class with a function enter_text that takes 2 arguments: locator of a field and text which fills that field
class BasePage:
def __init__(self, page):
self.page = page
...
0
votes
2
answers
621
views
Playwright and pytest. After the code is executed, one more blank tab is opened
A blank tab that doesn't make anything is open. It's waiting for a timeout because it doesn't execute any step. After that, the tab is closed and the test will fail. I have a different file pytest.ini ...
0
votes
0
answers
456
views
Element is not Attached to the DOM in Playwright Python
When I run this code, it opens chrome, goes to the link, loads data and then clicks on load more. When all the data is loaded, and the load more button disappears, it gives me the error that Element ...
0
votes
1
answer
71
views
Pause the main thread during the execute callback function
I am trying to use page.on to listening certain event, and once it is triggered I want to use callback function to handle it and pause the main thread operation till the callback finished. How can I ...
2
votes
3
answers
4k
views
"Event loop is closed! Is Playwright already stopped?" [duplicate]
Context
After initialisation of a playwright browser object in function initialise_playwright_browsercontroller, I try to use its Page object in another function. However, that yields get error:
&...
1
vote
1
answer
860
views
How to use locator in evaluate's javascript in Playwright python
I have the following script running:
def test_combobox_selected_by_label(page):
page.goto("http://www.tizag.com/htmlT/htmlselect.php")
element = page.get_by_role("combobox"...
2
votes
1
answer
5k
views
playwright force useragent for headless mode
How can I force the useragent in playwright python?
https://playwright.dev/python/docs/emulation#user-agent
def run(playwright):
""" config for browser """
...
5
votes
4
answers
6k
views
How to expect count bigger or smaller than?
Using Playwright and Python, how can I expect for count bigger or smaller than?
For example, this code expect for count of 2.
How do I achieve count >= 2 (Only bigger)
expect(self.page.locator('...
2
votes
1
answer
4k
views
AttributeError: module 'playwright' has no attribute 'chromium'
playwright install code
pip install playwright
playwright install
import code
from playwright.sync_api import playwright,sync_playwright
browser = playwright.chromium.launch(headless=False)
But,keep ...
0
votes
1
answer
1k
views
Is it possible to yield a playwright object in a fixture for reuse?
I am learning how to use pytest and keep running into an issue with fixtures.
Below is the source from the test file:
import asyncio, pytest
from SingletonObject import SObject
from playwright....
1
vote
1
answer
61
views
How to select an option from fiba page using playwright
I am trying to get the fiba world cup 2023 team stats where my country (Philippines) is one of the host nations.
The url of the page is: https://www.fiba.basketball/basketballworldcup/2023/teamstats
...
1
vote
3
answers
2k
views
How do I make Playwright in Python use a proxy?
I am currently trying to get a cross browser testing solution from BrowserStack to work with all our company frameworks.
For Selenium this works fine by adding os.environ['HTTPS_PROXY'] = ...
0
votes
2
answers
2k
views
Python Playwright - Want to print all text in <table> but finds 0 rows [closed]
I want to print all text in rows () with the help of Python and Playwright but on the specific website I'm trying to scrape it always finds 0 rows in the table, even though it has multiple ones.
want ...
0
votes
1
answer
739
views
Pytest playwright test works in debug mode but fails during normal run
I am trying to create a test script using Pytest and Playwright. My test works well in webkit. But has problems in Chromium. The test even works well in the debug mode (PWDEBUG=1). However on ...
1
vote
1
answer
3k
views
Getting net::ERR_TUNNEL_CONNECTION_FAILED Error While Using Proxy with Playwright for Python
I am trying to write an automation script that uses a proxy. I initially tried using Selenium, but it doesn't offer an easy way to authenticate the proxy since Selenium can't interact with the ...
0
votes
0
answers
673
views
Verify text on page without locator
I am using playwright, working with an ERP (IFS) system and I can't figure out the locator for my text on page to be verified. How can we verify the text on a page without locator?
I tried the ...
0
votes
1
answer
595
views
facing error in Infinite scrolling using playwright
How can i include infinite loading using playwright i have tried many solutions that i got online but none of them solved my issue
This is how it looks like it dosen't load the whole page instead it ...
1
vote
1
answer
482
views
Playwright Python gives inconsistent scraping results
My Playwright Python script goes to LeetCode problems url, Selects "Top 100 Liked Questions", scraps all the "Problem names" and goes to "Next page" until "Next page&...
1
vote
0
answers
2k
views
Javascript Click Event handler is not triggered when Playwright click is made
For one of the Automation cases written in Playwright Python, there is a need to listen to clicked element and get it's bounding box for further validation.
As the playwright documentation doesn't ...
1
vote
1
answer
3k
views
Playwright Python - Record video the newly opened page
I'm new to playwright automation and using Python. I'm stuck at recording video after a new page( opened in same window as new tab) is opened. The video is only showing for the first tab.
def ...
1
vote
1
answer
2k
views
How to iterate though the single object created by locator.all
I am using Playwirght.
I have get all the elements possible through the page.locator.all()
and then itrated it thorught the for loop
but now i want to futher itrate throught the each element of the ...
1
vote
1
answer
2k
views
Is there a quick way to check if iframe exists on page with Playwright and Python
So I am scraping a site that has a random popup via an iframe sporadically appear as you scroll down the page. On the iframe there is a button to get rid of it. However, it's hard to be certain when ...
0
votes
1
answer
1k
views
Unable to intercept request/response body in Playwright while web-scraping
Have the task to parse this page: https://privatleasing.volkswagen.se/valjmodell .I will need to get models and prices for leasing by entering each model's page and getting the data.
First problem is ...
1
vote
1
answer
787
views
Is there a way to change the browser clock with Playwright Python?
I need to change the clock of the Playwright Python browser. I know this can be done in JavaScript, but is there a way to do this with the Python Playwright library? I've tried converting the ...
2
votes
0
answers
5k
views
Dockerfile in Python for Playwright Chromium, installing error
I am trying to add playwright with chromium to a django project. I modify my docker to include the installation of playwright with chromium.
When i use docker-compose up --build and then execute the ...
1
vote
1
answer
71
views
3Button isn't clicking (need help)
I've had this issue for a couple of days now and I can't figure out the fix. I am new to Playwright and am trying to make it click a button on janitorai.com. There are two buttons that would both make ...
2
votes
2
answers
5k
views
How do I get the response associated with a specific GET request in playwright python?
I want to get the response associated with a GET request. I am using playwright python. I haven't been able to find anything on the internet to solve my problem, which is making me wonder if my ...
0
votes
1
answer
1k
views
Error when trying to enable trace in Playwright python POM in conftest.py
I'm a VERY new to Playwright and am trying to enable the trace. I am trying to follow the documentation but am receiving an error:
ERROR [100%]
test setup failed
page =
@pytest.fixture()
...
3
votes
0
answers
1k
views
Playwright/PyTest - Using Page Objects as Fixtures
I'm building an automation project using Playwright and Python.
This is the basic structure of my project:
I'm wondering about the best practice of using pytest fixtures in order to initialize my ...
0
votes
2
answers
513
views
Setting default language on AliExpress when using playwright
I'm trying to use the Playwright Async API as below to extract some data, and eventually to write some tests.
from playwright.async_api import async_playwright
async def aliexpress(browser_url, ...
-1
votes
1
answer
823
views
Playwright not locating non-english characters text
I am trying to click at a href tag text, in this case "São Vicente":
<li>
<a href="/comprar-casas/braga/sao-vicente/mapa">São Vicente</a>
<span class="...