microsoft / playwright-python

Python version of the Playwright testing and automation library.

Home Page:https://playwright.dev/python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: laywright._impl._errors.Error: Page.goto: Page crashed

CoolXi opened this issue · comments

Version

1.43.0

Steps to reproduce

  1. I install the latest playwright by pip install playwright

  2. Then install browser by playwright install

  3. Create a .py file, then write:
    from playwright.sync_api import sync_playwright

     with sync_playwright() as play:
         browser = play.chromium.launch(headless=False)
         page = browser.new_page()
         page.goto('https://www.baidu.com')
         print(page.title())
         page.fill('//input[@id="kw"]', 'python')    
         browser.close()
    
  4. Run the file

Expected behavior

Can operate normally

Actual behavior

The following error occurred:

Traceback (most recent call last):
File "D:\Python_Project\study1\test.py", line 7, in
page.goto('https://www.taobao.com')
File "D:\Python312\Lib\site-packages\playwright\sync_api_generated.py", line 8667, in goto
self._sync(
File "D:\Python312\Lib\site-packages\playwright_impl_sync_base.py", line 115, in _sync
return task.result()
^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\playwright_impl_page.py", line 500, in goto
return await self._main_frame.goto(**locals_to_params(locals()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\playwright_impl_frame.py", line 145, in goto
await self._channel.send("goto", locals_to_params(locals()))
File "D:\Python312\Lib\site-packages\playwright_impl_connection.py", line 59, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\playwright_impl_connection.py", line 513, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.goto: Page crashed
Call log:
navigating to "https://www.taobao.com/", waiting until "load"

Additional context

No response

Environment

- Operating System: [windows 10 64bit]
- CPU: [Intel i7]
- Browser: [Chromium]
- Python Version: [3.12]
- Other info:

I was not able to reproduce it.

Could you try to set the following environment variable and then run the script again?

$Env:DEBUG="pw:browser"
python test.py

(its for PowerShell as a terminal)

I was not able to reproduce it.

Could you try to set the following environment variable and then run the script again?

$Env:DEBUG="pw:browser"
python test.py

(its for PowerShell as a terminal)

I added the following as you said:
import os os.environ["DEBUG"] = "pw:browser"
Then the following error occurred on the terminal:
2024-04-10T11:01:29.743Z pw:browser C:\Users\xxxxx\AppData\Local\ms-playwright\chromium-1112\chrome-win\chrome.exe --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --no-sandbox --user-data-dir=C:\Users\kingdee\AppData\Local\Temp\playwright_chromiumdev_profile-nZkzTL --remote-debugging-pipe --no-startup-window
2024-04-10T11:01:29.754Z pw:browser pid=27548
2024-04-10T11:01:29.859Z pw:browser [pid=27548][err] [27548:27276:0410/190129.858:ERROR:chrome_browser_cloud_management_controller.cc(161)] Cloud management controller initialization aborted as CBCM is not enabled. Please use the --enable-chrome-browser-cloud-management command line flag to enable it if you are not using the official Google Chrome build.
2024-04-10T11:01:30.271Z pw:browser [pid=27548]
2024-04-10T11:01:30.348Z pw:browser [pid=27548]
2024-04-10T11:01:30.348Z pw:browser [pid=27548] starting temporary directories cleanup
2024-04-10T11:01:30.357Z pw:browser [pid=27548] finished temporary directories cleanup
2024-04-10T11:01:30.357Z pw:browser [pid=27548]
Traceback (most recent call last):
File "D:\Python_Project\study1\test.py", line 13, in
page.goto('https://www.baidu.com')
File "D:\Python312\Lib\site-packages\playwright\sync_api_generated.py", line 8667, in goto
self._sync(
File "D:\Python312\Lib\site-packages\playwright_impl_sync_base.py", line 115, in _sync
return task.result()
^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\playwright_impl_page.py", line 500, in goto
return await self._main_frame.goto(**locals_to_params(locals()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\playwright_impl_frame.py", line 145, in goto
await self._channel.send("goto", locals_to_params(locals()))
File "D:\Python312\Lib\site-packages\playwright_impl_connection.py", line 59, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\playwright_impl_connection.py", line 513, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.goto: Page crashed
Call log:
navigating to "https://www.baidu.com/", waiting until "load"

I'm not able to reproduce on my Windows 11 machine, maybe the site returns different content from your location.

If you start C:\Users\xxxxx\AppData\Local\ms-playwright\chromium-1112\chrome-win\chrome.exe manually, are you able to navigate to these sites?

Looks like this affects not only baidu.com it does also affect taobao.com?

Closing as per above since we were not able to repro.