Comments (3)
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto('http://playwright.dev')
page.on("pageerror", lambda error: print("Page error: ", error.name, ",", error.message, ",", error.stack))
page.evaluate("""
setTimeout(() => {
const error = new Error('error message');
error.name = 'CustomError';
throw error;
}, 0);
""")
page.wait_for_timeout(1000)
browser.close()
See here: https://playwright.dev/python/docs/api/class-page#page-event-page-error
from playwright-python.
I want to get the error type in the browser by playwright, the type is this: Uncaught TypeError.
<img width="590" alt="image" src="https://github.com/microsoft/playwright-python/assets/35483055/c32a6b38-93d6-485e-9e39-9820a2459396"
from playwright-python.
Thank you very much, it has been solved.
from playwright-python.
Related Issues (20)
- How to Dynamically pass values inside this locator HOT 2
- Unable to pass Dynamic values inside a Locator picked using Playwright Inspector HOT 1
- [Bug]: Zombie thread problem HOT 2
- [Bug]: laywright._impl._errors.Error: Page.goto: Page crashed HOT 4
- [Bug]: set_checked() doesn't work on checkbox element of a slider HOT 7
- How to locate the chromewebstore's confirm dialog? HOT 1
- how to get Twitter cookie and login with headless chromium HOT 1
- [Bug]: `Download.failure()` raises `TypeError: expected string or bytes-like object, got 'NoneType'`
- [Bug]: Error: net::ERR_PROXY_CONNECTION_FAILED .... is of type playwright._impl._errors.Error HOT 1
- [Bug]: Future finished exception=TargetClosedError('Target page, context or browser has been closed')
- [Bug]: Using playwright browser to measure the FCP & LCP caused inaccuracy HOT 1
- [Feature]: allow reuse of JavaScript functions HOT 1
- What is the value list for local in Playwright? HOT 1
- [Bug]: use async api with threading moudle cause process hang forever HOT 1
- When I open the browser using playwright.chromium. launch_persistent_context, I use page. go to open a URL for example https://111.html To manually open a URL for the tag page https://222.html The tag page does not have a URL when calling context. pages https://222.html What is the reason for the page, and how can I obtain the second page? HOT 1
- [Question]The content.pages method cannot retrieve all pages HOT 2
- [Bug]: Apple App store link is not opening in a new tab while clicking a link [mobile: iPhone 13] HOT 1
- [Bug]: proxy not connect HOT 1
- [Bug]: In mac sonoma, browser the installed version and the using version are missmatching. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from playwright-python.